여러 사이트를 구성하는 nginx에 문제가 있습니까?

WBOY
풀어 주다: 2016-08-25 10:37:18
원래의
1034명이 탐색했습니다.

nginx를 사용하여 두 사이트를 구성합니다. 한 사이트는 https 액세스용으로, 다른 사이트는 http 액세스용으로 구성해야 합니까?

서버 {

<code>    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   500 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;
    }
}
</code>
로그인 후 복사
로그인 후 복사

이렇게 구성하면 app.gzjjhd.com이 https://appgzjjhd.com이 되어 접속하게 됩니다. 하지만 나는 이것을 원하지 않습니다. http://app.gzjjhd.com에 가서 마스터들에게 어떻게 수정하는지 물어보고 싶어요!

답글 내용:

nginx를 사용하여 두 사이트를 구성합니다. 한 사이트는 https 액세스용으로, 다른 사이트는 http 액세스용으로 구성해야 합니까?

서버 {

<code>    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   500 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;
    }
}
</code>
로그인 후 복사
로그인 후 복사

이렇게 구성하면 app.gzjjhd.com이 https://appgzjjhd.com이 되어 접속하게 됩니다. 하지만 나는 이것을 원하지 않습니다. http://app.gzjjhd.com에 가서 마스터들에게 어떻게 수정하는지 물어보고 싶어요!

각각 두 개의 사이트 구성 파일 사용

내 포트 443이 점유된 것으로 나타났습니다

여러 사이트를 구성합니다. 즉, 동일한 서버가 여러 사이트를 로드합니다. ngixn에서 가상 호스트를 구성하고 기본 구성 파일에 서버를 직접 추가하면 됩니다. 심각하게

<code>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.ini
91        
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    </code>
로그인 후 복사

100 # Apache의 문서 루트가 .htaccess 파일에 대한 액세스를 거부합니다.
101 # nginx의 문서 루트와 일치합니다.
102 #
103 위치 ~ /.ht {
104 모두 거부;
105 }
106 }

여기서 포트 번호와 규칙을 직접 설정하면 됩니다.

관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
최신 이슈
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!