【发布时间】:2022-02-04 05:23:52
【问题描述】:
我正在尝试在 Azure 应用服务 (Linux) 上从 PHP 7.4 升级到 PHP 8。
它显示以下错误: 404 未找到 - nginx/1.14.2
我知道问题在于 PHP 8 的 Azure 使用 NGINX 而不是 Apache。 所以我按照这里给出的步骤: https://azureossd.github.io/2021/09/02/php-8-rewrite-rule/index.html
有一段时间它工作正常,但从它停止工作并重新启动后的第二天开始显示错误“404 Not Found nginx/1.14.2"
这是我的默认文件:
server {
#proxy_cache cache;
#proxy_cache_valid 200 1s;
listen 8080;
listen [::]:8080;
root /home/site/wwwroot;
index index.php index.html index.htm;
server_name example.com www.example.com;
location / {
index index.php index.html index.htm hostingstart.html;
try_files $uri $uri/ /index.php?$args;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /html/;
}
# Disable .git directory
#
location ~ /\.git {
deny all;
access_log off;
log_not_found off;
}
# Add locations of phpmyadmin here.
#
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param HTTP_PROXY "";
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param QUERY_STRING $query_string;
fastcgi_intercept_errors on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 3600;
fastcgi_read_timeout 3600;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
}
}
【问题讨论】:
-
也许它可能是相关的:现在有了上面的配置,主页(例如 myapp.azurewebsites.net/public )但其他任何页面都不起作用(例如 myapp.azurewebsites.net/public/test )
标签: php laravel azure nginx azure-web-app-service