In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Nginx static and dynamic separation
The dynamic and static separation is to make the dynamic web pages in the dynamic website distinguish between the immutable resources and the frequently changing resources according to certain rules. after the dynamic and static resources are split, we can cache them according to the characteristics of the static resources. this is the core idea of website static processing.
The simple summary of dynamic and static separation is: the separation of dynamic files and static files.
Pseudo-static: if the site wants to be searched by search engines, dynamic page static technology, such as freemarker template engine technology.
Reverse agency principle
Nginx not only acts as a Web server, but also has the functions of reverse proxy, load balancing and caching.
Nginx proxies the client's request to the upstream server through the proxy module, and the connection between nginx and the upstream server is carried out through the http protocol.
The most important instruction of Nginx when implementing reverse proxy function is proxy_ pass, which can and can schedule user requests to upstream servers according to URI, client parameters or other processing logic.
In this case, according to the needs of the enterprise, the static and dynamic separation is realized by configuring Nginx, and the request for the php page is forwarded to LAMP for processing, while the static page is handed over to Nginx for processing to achieve static and dynamic separation.
The architecture is shown in the figure:
Experimental environment
Deployed LAMP architecture, deployed LNMP architecture
Experimental process
I.
1. Set up and debug the back-end LAMP environment
Install the Apache service
Yum install httpd httpd-devel-y
two。 Set permissions for the http service at the firewall
[root@localhost ~] # firewall-cmd-- permanent-- zone=public-- add-service=httpsuccess # allows http and https services to be enabled, and allows firewall [root@localhost ~] # systemctl start httpd to be reloaded through the firewall [root@localhost ~] # firewall-cmd-permanent-zone=public-add-service=httpssuccess [root@localhost ~] # firewall-cmd-- reload success #
3. Install the mariadb database
Mariadb database management system is a branch of MySQL and is mainly maintained by the open source community. The purpose of licensing mariadb with GPL is to be fully compatible with MySQL, including API and the command line, so that it can easily become a substitute for MySQL.
[root@localhost ~] # yum install mariadb mariadb-server mariadb-libs mariadb-devel-y [root@localhost ~] # systemctl start mariadb.service
4.mysql Security configuration Wizard
[root@localhost ~] # mysql_secure_installation
5. Install php and supported softwar
[root@localhost ~] # yum install php- y [root@localhost] # yum install php-mysql-y [root@localhost ~] # yum install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel php-bcmath-y
6. Modify the main page of a web page
[root@localhost ~] # cd / var/www/html [root@localhost html] # vim index.php [root@localhost html] # systemctl restart httpd
Access Test:
II. Compile and install nginx
The manual compilation and installation process of nginx can be viewed as follows:
Https://blog.51cto.com/14557905/2460945
1. Deploy nginx service management control
[root@localhost ~] # vim / ETC instart init.dGinxUnix instart PROG:-99 2 pound description: Ngins Service Control ScriptPROG= "/ usr/local/nginx/sbin/nginx" PIDF= "/ usr/local/nginx/logs/nginx.pid" case "$1" instart) $PROG;; stop) kill-s QUIT $(cat $PIDF);; restart) $0 stop $0 start;; reload) kill-s HUP $(cat $PIDF) *) echo "Usage: $0 {start | stop | restart | reload}" exit 1esacexit 0 [root@localhost ~] # chmod + x / etc/init.d/nginx # raise the rights [root@localhost ~] # chkconfig-- add nginx # specified user [root@localhost ~] # service nginx start # enable the service
two。 Start the service and turn off the firewall
[root@nginx ~] # systemctl stop firewalld.service [root@nginx ~] # setenforce 0 [root@nginx ~] # service nginx start
Access test
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.