100分悬赏,nginx配置https导致php出现502。

laitecn 2017-09-19 09:51:59
出国看病www.auromcs.cn这个网站:
http下打开php文件正常,后来升级了https,配置如下,
http {
include mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 1024m;
client_body_buffer_size 10m;
sendfile on;
tcp_nopush on;
keepalive_timeout 120;
server_tokens off;
tcp_nodelay on;

fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
fastcgi_intercept_errors on;

#Gzip Compression
gzip on;
gzip_buffers 16 8k;
gzip_comp_level 6;
gzip_http_version 1.1;
gzip_min_length 256;
gzip_proxied any;
gzip_vary on;
gzip_types
text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml
text/javascript application/javascript application/x-javascript
text/x-json application/json application/x-web-app-manifest+json
text/css text/plain text/x-component
font/opentype application/x-font-ttf application/vnd.ms-fontobject
image/x-icon;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";

#If you have a lot of static files to serve through Nginx then caching of the files' metadata (not the actual files' contents) can save some latency.
open_file_cache max=1000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;

######################## default ############################

server {
listen 443;
server_name www.auromcs.cn;
root /data/wwwroot/default;
index index.html index.htm index.php;
ssl on;
ssl_certificate /etc/nginx/server.crt;
ssl_certificate_key /etc/nginx/server.key;
location ~ .*\.(php|php5)?$ {
root /data/wwwroot/default;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param HTTPS on;
include fastcgi_params;
include fastcgi.conf;
}
}

server {
listen 80;
server_name www.auromcs.cn;
rewrite ^(.*)$ https://$host$1 redirect;
}

########################## vhost #############################
include vhost/*.conf;
}


现在访问html、htm文件正常,打开主页的index.php就出现了502,求解决方案。
...全文
563 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
e3e4e7 2017-10-21
  • 打赏
  • 举报
回复
下面是成功的配置,你可以复制修改一下文件名路径等参数应该没问题(这里CA证书是文件验证方式是.pem和key文件) server { listen 80; listen 443 ssl; server_name www.auromcs.cn; ssl_certificate cert/你的.pem; ssl_certificate_key cert/你的.key; ssl_session_timeout 5m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; if ($scheme = http){return 301 https://$host$request_uri;} location / { root /data/wwwroot/default; index index.html index.php index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /data/wwwroot/default; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME /data/wwwroot/default$fastcgi_script_name; include fastcgi_params; } }
傲雪星枫 2017-10-21
  • 打赏
  • 举报
回复
傲雪星枫 2017-09-24
  • 打赏
  • 举报
回复
php-fpm.conf 你是怎样写的
果酱很好吃 2017-09-20
  • 打赏
  • 举报
回复
贴出你的 php-fpm.conf
果酱很好吃 2017-09-19
  • 打赏
  • 举报
回复
贴出你的 nginx 错误日志
laitecn 2017-09-19
  • 打赏
  • 举报
回复
php-fpm日志在变成https就不记录,是不是php-fpm不支持https
laitecn 2017-09-19
  • 打赏
  • 举报
回复
php-fpm日志已经没有新的记录,已经不记录日志了,可能是php-fpm出了问题。
果酱很好吃 2017-09-19
  • 打赏
  • 举报
回复
看你的 php-fpm日志 日志在 php-fpm.conf 里面配置的 error_log 的路径下
laitecn 2017-09-19
  • 打赏
  • 举报
回复
nginx启动没啥问题

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧