Linux Web server Build-nginx article

Source: Internet
Author: User

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

    1. 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
      1. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.