我用nginx配置两个站点,一个站点要配置成https访问,一个是http来访问?
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 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; }}
我这样配置完,app.gzjjhd.com 也变成 https://appgzjjhd.com 来访问。但是我不想要这样。我要http://app.gzjjhd.com 请教各位大神如何修改!
回复内容: 我用nginx配置两个站点,一个站点要配置成https访问,一个是http来访问?
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 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; }}
我这样配置完,app.gzjjhd.com 也变成 https://appgzjjhd.com 来访问。但是我不想要这样。我要http://app.gzjjhd.com 请教各位大神如何修改!
分别用两个站点配置文件
原来是我的443端口被占用了
配置多个站点, 也就是虚拟主机的意思, 同一个server,加载多个站点, 在ngixn中配置虚拟主机,直接在主配置文件添加一个server{} 就可以了, 仿照他自带的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
100 # 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 }
直接在这里制定端口号和规则就可以了。