Nginx Configure multiple site problems?

Source: Internet
Author: User
Tags fpm
I use Nginx configuration two sites, one site to be configured for HTTPS access, one is HTTP to access?

server {

    Listen 443;            server_name www.gzjjhd.com;    SSL on;    Ssl_certificate E:/WEBSERVER/NGINX/SSLKEY/WOSIGN.COM.CRT;    Ssl_certificate_key E:/webserver/nginx/sslkey/wosign.com.key;    Ssl_session_timeout 5m;    Ssl_protocols TLSv1 TLSv1.1 TLSv1.2; Ssl_ciphers aesgcm:all:! Dh:! export:! rc4:+high:! medium:!    Low:!anull:!enull;    Ssl_prefer_server_ciphers on;        Location/{root e:/www/jsd;    Index index.php index.html index.htm;    } error_page 502 503 504/50x.html;    Location =/50x.html {root html;        } location ~ \.php$ {root e:/www/jsd;        Fastcgi_pass 127.0.0.1:9000;        Fastcgi_index index.php;        Fastcgi_param script_filename $document _root$fastcgi_script_name;    Include Fastcgi_params;    }}server {Listen 80;    server_name app.gzjjhd.com;        Location/{root e:/www/hdweb;    Index index.php index.html index.htm; } error_page 500 502 503 504/50x.html;    Location =/50x.html {root html;        } include e:/www/hdweb/rewrite.conf;        Location ~ \.php$ {root E:/www/hdweb;        Fastcgi_pass 127.0.0.1:9000;        Fastcgi_index index.php;        Fastcgi_param script_filename $document _root$fastcgi_script_name;    Include Fastcgi_params; }}

When I do this, app.gzjjhd.com also becomes https://appgzjjhd.com to visit. But I don't want to do that. I want to http://app.gzjjhd.com ask you how to modify the great God!

Reply content:

I use Nginx configuration two sites, one site to be configured for HTTPS access, one is HTTP to access?

server {

    Listen 443;            server_name www.gzjjhd.com;    SSL on;    Ssl_certificate E:/WEBSERVER/NGINX/SSLKEY/WOSIGN.COM.CRT;    Ssl_certificate_key E:/webserver/nginx/sslkey/wosign.com.key;    Ssl_session_timeout 5m;    Ssl_protocols TLSv1 TLSv1.1 TLSv1.2; Ssl_ciphers aesgcm:all:! Dh:! export:! rc4:+high:! medium:!    Low:!anull:!enull;    Ssl_prefer_server_ciphers on;        Location/{root e:/www/jsd;    Index index.php index.html index.htm;    } error_page 502 503 504/50x.html;    Location =/50x.html {root html;        } location ~ \.php$ {root e:/www/jsd;        Fastcgi_pass 127.0.0.1:9000;        Fastcgi_index index.php;        Fastcgi_param script_filename $document _root$fastcgi_script_name;    Include Fastcgi_params;    }}server {Listen 80;    server_name app.gzjjhd.com;        Location/{root e:/www/hdweb;    Index index.php index.html index.htm; } error_page 500 502 503 504/50x.html;    Location =/50x.html {root html;        } include e:/www/hdweb/rewrite.conf;        Location ~ \.php$ {root E:/www/hdweb;        Fastcgi_pass 127.0.0.1:9000;        Fastcgi_index index.php;        Fastcgi_param script_filename $document _root$fastcgi_script_name;    Include Fastcgi_params; }}

When I do this, app.gzjjhd.com also becomes https://appgzjjhd.com to visit. But I don't want to do that. I want to http://app.gzjjhd.com ask you how to modify the great God!

Two site profiles for each of the files

It turns out that my 443 port is occupied.

Configure multiple sites, that is, the meaning of the virtual host, the same server, load multiple sites, configure the virtual host in Ngixn, directly add a server{} in the main configuration file, and emulate the parameters of his own sever.

78    server {79        listen 80;80    #    listen somename:8080;81        server_name www.xuping.com;82        root /usr/share/nginx/xuping;83        index index.html index.htm;84    85        location / {86            try_files $uri $uri/ =404;87        }88        location ~ \.php$ {89            fastcgi_split_path_info ^(.+\.php)(/.+)$;90            # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini91        92            # With php5-cgi alone:93        #    fastcgi_pass 127.0.0.1:9000;94        #    # With php5-fpm:95            fastcgi_pass unix:/var/run/php5-fpm.sock;96            fastcgi_index index.php;97            include fastcgi_params;98        }99    

# Deny access to. htaccess files, if Apache ' s document Root
101 # concurs with Nginx ' s one
102 #
103 Location ~/.ht {
104 Deny all;
105}
106}

Make the port number and rules right here.

  • Related 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.