我有一个具有Nginx运行节点和PHP的Ubuntu服务器。
已实现:
问题:
本应在/后端运行的Symfony应用程序正在/后端/web/app上运行_php和app.php(生产模式)抛出一个500服务器错误。(截图附后)
Nginx配置如下:
# Default Server Settings
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.php app.php;
server_name 100.100.100.100;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://localhost:3030/;
proxy_ssl_session_reuse off;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_redirect off;
}
# WORDPRESS SETTINGS
location @blog {
rewrite ^/blog(.*) /blog/index.php?q=$1;
}
location /blog {
index index.php
alias /var/www/html/blog;
try_files $uri $uri/ @blog;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
access_log /var/log/nginx/blog-access.log;
error_log /var/log/nginx/blog-error.log;
}
# SYMFONY SETTINGS
location @backend {
rewrite ^/backend(.*)$ /web/app.php/$1 last;
}
location /backend {
index app.php
alias /var/www/html/backend/web;
try_files $uri $uri/ @backend;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
access_log /var/log/nginx/symposh-access.log;
error_log /var/log/nginx/symposh-error.log;
}
location ~ /\.ht {
deny all;
}
}
发布于 2018-08-02 14:47:32
你可以使用下面的nginx配置-
# SYMFONY SETTINGS
location /backend {
index app.php;
alias /var/www/html/backend/web;
try_files $uri $uri/ /sf/app.php?$args;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
access_log /var/log/nginx/symposh-access.log;
error_log /var/log/nginx/symposh-error.log;
}
https://stackoverflow.com/questions/-100005896
复制相似问题