当我尝试访问使用proxy_pass
的路径时出现502错误。我检查了/var/log/nginx/error.log
,但没有显示502错误。
如果未记录此错误,如何调试此错误?
这是我的网站配置的样子(在网站中可用):
upstream php-handler {
server unix:/var/run/php5-fpm.sock;
}
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
server_name example.com www.example.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name example.com;
ssl_certificate /etc/ssl/www.example.com.crt;
ssl_certificate_key /etc/ssl/www.example.com.key;
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
root /var/www/example.com/;
index index.html index.php;
client_max_body_size 500M;
fastcgi_buffers 64 4k;
gzip on;
location / {
try_files $uri $uri/ =404;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
location /apps/myApp/ {
proxy_pass https://localhost:3030;
}
}
答案 0 :(得分:1)
此:
location /apps/myApp/ {
proxy_pass https://localhost:3030;
}
应该是这样的:
location /apps/myApp/ {
proxy_pass http://localhost:3030;
}