Nginx Series (I. Installing NGINX)

Source: Internet
Author: User

0. Disclaimer:

The following applies to the Linux environment, the use of source-style installation

Nginx Official Website Installation Guide: HTTP://WIKI.NGINX.ORG/INSTALLCHS

One. Download Nginx

1. Website Download: http://nginx.org/en/download.html
2.Git Download: Https://github.com/nginx/nginx

Two. Necessary dependent libraries

1.pcre

install#nginx rewrite模块

2.gcc

install#编译nginx
Three. Installing Nginx

1. Create the installation folder

mkdir -p /web/nginx

2. Create a running user

-r-g www www

3. Compiling parameters

.--prefix=--with-http_stub_status_module--with-pcre

after successful configuration, output the following:

4. Compiling the installation

makemake install

after compiling successfully, output the following content

Four. Start Nginx
/web/nginx/sbin/nginx
Five. Check if the installation is successful

1. Open port Reference http://blog.csdn.net/qlong_dd/article/details/45312031

2. Access 127.0.0.1, display the following interface, indicating that Nginx installation is successful

Six. Formula configuration
Userwww www;worker_processes  1;#error_log Logs/error.log;Error_logLogs/error.logNotice;#error_log logs/error.log info;#pid logs/nginx.pid;Events{worker_connections  1024x768;}http{includeMime.types;Default_typeApplication/octet-stream;Log_formatMain'$remote _addr - $remote _user [$time _local] "$request"                      '$status $body _bytes_sent '$http _referer '                      ' "$http _user_agent" "$http _x_forwarded_for" ';Access_logLogs/access.log main;Sendfile         on;#tcp_nopush on;    #keepalive_timeout 0;    Keepalive_timeout   $;#gzip on;    Server{Listen        the;server_namelocalhost#charset koi8-r;        #access_log Logs/host.access.log main;         Location/ {Root/web/www/html;IndexIndex.html index.htm; }#error_page 404/404.html;        # REDIRECT Server error pages to the static page/50x.html        #        Error_page    - 502 503 504/50x.html; Location=/50x.html {Roothtml }# Proxy The PHP scripts to Apache listening on 127.0.0.1:80        #        #location ~ \.php$ {        # Proxy_pass http://127.0.0.1;        #}        # Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000        #        #location ~ \.php$ {        # root HTML;        # Fastcgi_pass 127.0.0.1:9000;        # Fastcgi_index index.php;        # Fastcgi_param Script_filename/scripts$fastcgi_script_name;        # include fastcgi_params;        #}        # Deny access to. htaccess files, if Apache ' s document Root        # concurs with Nginx ' s one        #        #location ~/\.ht {        # deny all;        #}}# Another virtual host using mix of ip-, name-, and port-based configuration    #    #server {    # Listen 8000;    # listen somename:8080;    # server_name Somename alias Another.alias;    # location/{    # root HTML;    # index index.html index.htm;    #    }    #}    # HTTPS Server    #    #server {    # Listen 443 SSL;    # server_name localhost;    # ssl_certificate Cert.pem;    # Ssl_certificate_key Cert.key;    # Ssl_session_cache shared:ssl:1m;    # ssl_session_timeout 5m;    # ssl_ciphers high:!anull:! MD5;    # ssl_prefer_server_ciphers on;    # location/{    # root HTML;    # index index.html index.htm;    #    }    #}}

Nginx Series (I. Installing NGINX)

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.