首页 / PHP / php – 分享Nginx服务器配置
php – 分享Nginx服务器配置
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了php – 分享Nginx服务器配置,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2046字,纯文字阅读大概需要3分钟。
内容图文
![php – 分享Nginx服务器配置](/upload/InfoBanner/zyjiaocheng/962/63dfff1258434db4bbddaf417adc0744.jpg)
如何在两台服务器之间共享通用配置.我的应用程序支持http和https(少数页面),我目前正在使用fastcgi_param来保存敏感信息,如数据库名称和密码.我如何共享服务器的位置和fastcgi_param(80,443).
server { listen 80; server_name example.com; } server { listen 443 ssl; server_name example.com; root /home/forge/example.com/public; # FORGE SSL (DO NOT REMOVE!) ssl on; ssl_certificate /etc/nginx/ssl/example.com/304/server.crt; ssl_certificate_key /etc/nginx/ssl/example.com/304/server.key; index index.html index.htm index.php; charset utf-8; location / { try_files $uri $uri/ /index.php?$query_string; } location = /favicon.ico { access_log off; log_not_found off; } location = /robots.txt { access_log off; log_not_found off; } access_log off; error_log /var/log/nginx/example.com-error.log error; error_page 404 /index.php; location ~ \.php${ fastcgi_param ENV "production"; fastcgi_param DB_HOST "127.0.0.1"; fastcgi_param DB_PASSWORD "123456"; fastcgi_param DB_USERNAME "user"; fastcgi_param DB_NAME "example"; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } location ~ /\.ht { deny all; } }
我想分享:
index index.html index.htm index.php; charset utf-8; location / { try_files $uri $uri/ /index.php?$query_string; } location = /favicon.ico { access_log off; log_not_found off; } location = /robots.txt { access_log off; log_not_found off; } access_log off; error_log /var/log/nginx/example.com-error.log error; error_page 404 /index.php; location ~ \.php${ fastcgi_param ENV "production"; fastcgi_param DB_HOST "127.0.0.1"; fastcgi_param DB_PASSWORD "123456"; fastcgi_param DB_USERNAME "user"; fastcgi_param DB_NAME "example"; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } location ~ /\.ht { deny all; }
解决方法:
从0.7.14开始,您可以将HTTP和HTTPS服务器块组合成一个 – 更容易维护:
server {
listen 80;
listen 443 ssl;
server_name example.com;
...
}
看看吧
http://nginx.org/en/docs/http/configuring_https_servers.html#single_http_https_server
详情.
内容总结
以上是互联网集市为您收集整理的php – 分享Nginx服务器配置全部内容,希望文章能够帮你解决php – 分享Nginx服务器配置所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。