如果一站点既要80 http访问,又要443https访问。

要让https和http并存,不能在配置文件中使用ssl on,配置listen 443 ssl;

实例

server
{

listen 80;
listen 443 ssl;
server_name www.iamle.com;
index index.html index.htm index.php;
root /home/wwwroot/www.iamle.com/;
#ssl on; 这里要注释掉
ssl_certificate /usr/local/nginx/conf/ssl/www_iamle_com.crt;
ssl_certificate_key /usr/local/nginx/conf/ssl/www_iamle_com.key;

#以下配置省略

}

 

 

 

From:http://nginx.org/en/docs/http/configuring_https_servers.html#single_http_https_server

It is good practice to configure separate servers for HTTP and HTTPS protocols from the very start. Although their functionalities currently seem equal, this may change significantly in the future and using a consolidated server may become problematic. However, if HTTP and HTTPS servers are equal, and you prefer not to think about the future, you may configure a single server that handles both HTTP and HTTPS requests by deleting the directive “ssl on” and adding the “ssl” parameter for *:443 port:

       看到很多朋友不知道怎么简单的检查tcp端口客户机上是否能访问到。这里说说用telnet命令检查tcp端口是否正常工作。这里用我vps上的网站80端口做演示。由于win下和linux在这里的命令都一样,所以就通用了。telnet命令的妙用了。

       服务端:

开启某个tcp应用后,比如nginx开放的tcp80端口提供web服务。

在命令控制台输入命令如:图1

[root@wwek ~]# netstat -ano

image

图1

tcp3306是mysql默认的tcp监听端口

tcp80是nginx提供web服务的监听端口

这里服务器就算是正常工作了。

继续阅读