Three aspects of Nginx use
1. A lightweight Web server
2. Reverse proxy or Load balancing
3. Cache server
Nginx uses the Epoll model, Apache uses the traditional select model, so nginx can handle more concurrency when dealing with static small files.
Source code installation.
Check if the system has pcre (rewrite module that allows Nginx to support HTTP), Pcre-devel OpenSSL------"Base dependency Package
Openssl-devel used when using HTTPS
installation process
cd/tuwei/tools/
wget http://nginx.org/download/nginx-1.6.3.tar.gz------"Download Nginx
Tar XF nginx-1.6.3.tar.gz
CD nginx-1.6.3
Useradd nginx-s/sbin/nologin-m-----------> Create nginx service user
./configure--user=nginx--group=nginx--prefix=/application/nginx-1.6.3/\
--with-http_stub_status_module--with-http_ssl_module
Make&&make Install
Create a soft connection after installation to facilitate subsequent use
Ln-s/application/nginx-1.6.3//application/nginx
Check grammar before starting Nginx service and develop good habits.
/application/nginx/sbin/nginx-t
The following information appears
[Email protected] html]#/application/nginx/sbin/nginx-t
Nginx:the configuration file/application/nginx-1.6.3//conf/nginx.conf syntax is OK
Nginx:configuration file/application/nginx-1.6.3//conf/nginx.conf Test is successful
If you are prompted that the relevant module does not exist, place the module path in the module configuration file
Cat/etc/ld.so.conf
Execute ldconfig make configuration changes take effect
Start Nginx Service
/application/nginx/sbin/nginx
Check whether the service is started
- Ps-ef |grep Nginx
2.netstat-tnlp|grep 80
3.wget 127.0.0.1
4.curl-i 127.0.0.1
Check Nginx startup effect, browser access
If you cannot access
1. Turn off SELinux
2. Shut down the firewall, in the production environment, if there is an external network IP, please allow 80 port access
Iptables-i input-p TCP--dport 80-j ACCEPT
The trilogy of Client Access website exception troubleshooting
1. Client Ping IP------"Physical line
- Telnet IP-------"service-side firewall
3. Server-side wget IP or curl-i IP------"Impersonate user access, exclude HTTP service problems, and then exclude
4. Service Side view Service error log
403 Error
1. No Home file
2. Home file permissions are not enough
Kill HUP cat nginx.pid
equivalent to restart Nginx service
Create a simple site
Create your own index.html
Put in the/application/nginx/html directory and then access, nginx default site file is index.html.
Linux Web server Build-nginx article