Use of nginx

Source: Internet
Author: User

Use of nginx

1. Download the installation package: wget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm

Installation rpm-ivhnginx-release-centos-6-0.el6.ngx.noarch.rpm

Or

 

Yum install nginx


Directory:/usr/sbin/nginx/etc/nginx/conf. d

Start/usr/sbin/nginx

Stop pkill-9 nginx

Load configuration:/usr/sbin/nginx-s reload

 

The configuration directory is "/etc/nginx/". By default, two configuration files are contained, Nginx. conf and conf. d/default. conf. Nginx actually accesses Nginx. conf first, and conf. d/default. conf is the configuration file referenced in the Nginx. conf configuration file.


Configure multiple domain names: one primary domain name and one secondary domain name under the same project

 

Upstream website {server 192.168.10.158: 28080 weight = 1;} server {listen 80; server_name tool.com; location =/{rewrite/http://tool.com/tools/jsp/index.jsp; # Jump to the level 1 domain name homepage when you do not add this access level 2 domain name} location ~ /{Proxy_pass http: // website; proxy_set_header Host $ host: 80; proxy_set_header X-Real-IP $ remote_addr; proxy_set_header X-Forwarded-For $ scheme; Limit 90; Limit 90; proxy_read_timeout 90; proxy_ignore_client_abort on;} server {listen 80; server_name testxmf.com; # charset koi8-r; access_log/etc/nginx/conf. d/log/host. access. log main; location ~ /{Proxy_pass http: // website; rewrite/tools /(. +) http://tool.com/tools/4241; proxy_set_header X-Forwarded-For $ timeout; proxy_send_timeout 90; proxy_connect_timeout 90; proxy_read_timeout 90; stored on ;}# error_page 404/404 .html; # redirect server error pages The static page/50x.html # error_page 500 502 503 x.html; location =/50x.html {root/usr/share/nginx/html;} # 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. htaccess files, if Apache's document root # concurs with nginx's one # location ~ /\. Ht {# deny all ;#}}


 

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.