发布于 2015-11-12 14:25:42 | 647 次阅读 | 评论: 0 | 来源: PHPERZ
这里有新鲜出炉的Nginx开发从入门到精通,程序狗速度看过来!
Nginx WEB服务器
Nginx 是一个高性能的 HTTP 和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 代理服务器。 Nginx 是由 Igor Sysoev 为俄罗斯访问量第二的 Rambler.ru 站点开发的,第一个公开版本0.1.0发布于2004年10月4日。其将源代码以类BSD许可证的形式发布,因它的稳定性、丰富的功能集、示例配置文件和低系统资源的消耗而闻名。
相关的软件的安装在这里就不表述了。
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/cert.key -out /etc/nginx/cert.crt
server { listen 443; server_name python.org *.python.org; ssl_certificate /etc/nginx/cert.crt; ssl_certificate_key /etc/nginx/cert.key; ssl on; ssl_session_cache builtin:1000 shared:SSL:10m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4; ssl_prefer_server_ciphers on; access_log /var/log/nginx/python.log; location / { proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # proxy_pass $request; proxy_pass https://$host$uri; } }
使用Nginx手册上的如下指令无效
proxy_pass $request;
然后修改nginx.conf。
在 http 节点下添加域名解析:
resolver 8.8.8.8;
修改hosts文件,测试
wget --no-check-certificate -d 'https://www.python.org'
测试OK。顺利完成安装。
但是不能在浏览器上访问,因为我们的证书不是由权威机构颁发的。
弄完这一切,尼玛 www.python.org 又可以访问了。