In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Nginx is specially developed for performance optimization. Its biggest advantages are its stability and low system resource consumption, as well as its high processing capacity for http concurrent connections. A single physical server can support 20000 to 50000 concurrent requests. For this reason, a large number of enterprises providing social networks, news and information, e-commerce and web hosting services have chosen Nginx to provide web services. At present, Chinese mainland uses nginx website users: Sina, NetEase, Tencent, and the well-known microblog Plurk also uses nginx.
Nginx is a powerful high-performance Web and reverse proxy server with many excellent features:
High concurrency connections: the official test can support 50,000 concurrent connections, reaching 2pm and 3W concurrent connections in the actual production environment. Low memory consumption: under 3W concurrent connections, 10 NGINX processes open consume only 150m of memory (15M*10=150M) the configuration file is very simple: the style is as easy to understand as the program. Low cost: Nginx, as open source software, can be used free of charge, while the purchase of F5 BIG-IP, NetScaler and other hardware load balancing switches need more than 100,000 to hundreds of thousands of RMB. Rewrite rewriting rules are supported: HTTP requests can be distributed to different backend server groups according to different domain names and URL. Built-in health check function: if the backend web server of the Nginx Proxy backend goes down, the front-end access will not be affected. Bandwidth savings: GZIP compression is supported, and Header headers can be added to the browser's local cache. High stability: for reverse proxies, the probability of downtime is minimal.
Without saying much about the theoretical knowledge of Nginx, let's get down to business and set up a Nginx website server:
1. One centos 7 server
2. One centos 7 system disk
3. The software package you need to use. Here is a ready one to extract the link:
Extract connection
First, start building the Nginx website:
1. Mount the system CD and initialize the yum source
[root@Centos02 ~] # mount / dev/cdrom / mnt/ # Mount system CD [root@centos02 ~] # mkdir / etc/yum.repos.d/bak # create system yum backup directory [root@centos02 ~] # mv / etc/yum.repos.d/CentOS-* / etc/yum.repos.d/bak/ # all files that come with the system's yum configuration files that begin with Centos- Copy to the bak directory [root@centos02 ~] # vim / etc/yum.repos.d/local.repo # to create a yum configuration file [local] name=centosbaseurl= file:///mntenabeld=1gpgcheck=0
2. Install nginx
[root@centos02 ~] # yum-y install pcre pcre-devel zlib-devel # installation dependency [root@centos02 ~] # umount / mnt/ # Uninstall the system CD Switch package CD [root@centos02] # mount / dev/cdrom / mnt/ # Mount package CD [root@centos02] # tar zxvf / mnt/nginx-1.6.0.tar.gz-C / usr/src/ # extract the programs in the mnt directory to / src [root@centos02] # useradd-M-s / sbin/nologin nginx # user who created the managed nginx [root@centos02 ~] # cd / usr/src/nginx-1.6.0/ # compiled and installed nginx [root @ centos02 nginx-1.6.0] #. / configure-- prefix=/usr/local/nginx-- user=nginx-- group=nginx-- with-http_stub_status_module [root@centos02 nginx-1.6.0] # make & & make install # compiled and installed nginx [root @ Centos02 nginx-1.6.0] # ln-s / usr/local/nginx/sbin/nginx* / usr/local/sbin/ # optimized execution command [root@centos02 ~] # echo "www.benet.com" > / usr/local/nginx/html/index.html # modify the new page to overwrite the old page [root@centos02] # vim / usr/local/nginx/conf/nginx.conf # set Nginx maximum concurrency 12 events {13 worker_connections 4096 14}
2. Configure nginx virtual host
[root@Centos02 ~] # vim / usr/local/nginx/conf/nginx.conf # nginx configuration virtual host www.benet.com35 server {# Server represents virtual host 36 listen 80; # virtual host listening port 37 server_name www.benet.com # Virtual host domain 38 charset utf-8; # support character encoding 39 access_log logs/www.benet.com.access.log; # success log location / usr/local/nginx/logs/ 40 error_log logs/www.benet.com.error.log # error log / usr/local/nginx/logs/ 41 location / {42 root / var/www/benetcom/; # website root (default / usr/local/nginx/html/) 43 index index.html index.htm # homepage index.html or index.htm 44} 45} [root@Centos02 ~] # mkdir-p / var/www/benetcom # create the root directory of the www.benet.com virtual host site [root@Centos02 ~] # echo "www.benet.com" > / var/www/benetcom/index.html # create www.benet.com virtual host home page [root@Centos02 ~] # vim / usr/local/nginx/conf/nginx.conf # configure www.accp.com virtual host 47 server {# Server means virtual host 48 listen 80 # Virtual host listening port 49 server_name www.accp.com; # virtual host domain 50 charset utf-8; # support character encoding 51 access_log logs/www.accp.com.access.log # success log location / usr/local/nginx/logs/52 error_log logs/www.accp.com.error.log; # error log / usr/local/nginx/logs/53 location / {54 root / var/www/accpcom/ # website root directory (default / usr/local/nginx/html/) 55 index index.html index.htm # homepage index.html or index.htm56} 57} [root@Centos02 ~] # mkdir-p / var/www/accpcom # create the root directory of the www.accp.com virtual host site [root@Centos02 ~] # echo "www.accp.com" > / var/www/accpcom/index.html # set up the home page of the www.accp.com virtual host website
3. Start Nginx
[root@centos02 ~] # nginx # start nginx [root @ centos02 ~] # killall-s QUIT nginx # stop nginx [root@centos02 ~] # killall-s HUP nginx # restart nginx
4. The client verifies the Nginx to ensure that the network of the client and the centos 7 server is interconnected, otherwise it is nonsense (you need to manually add the host file to build the DNS here, and then configure the LNMP and LAMP in detail later)
1. Add host file
2. Client access
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.