我有一個 codecanyon 專案,它可以安裝在共享主機中而不會出現任何錯誤。像魅力一樣作業。但是我試圖使用 docker-compose 安裝相同的。我收到錯誤,因為“不支持 POST 方法”
人們建議使用 laravel codefix 來解決此類錯誤,但在我的情況下,代碼在 Sharedhosting 中有效。我認為 nginx 配置不是 laravel 代碼的一些問題。
我不是專家,希望有人能指出我在哪里挖掘。
Laravel 錯誤堆疊
Docker 控制臺


默認.conf
server {
listen 80;
server_name starhardware.com.my;
root /var/www/app;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
index 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; }
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
nginx.conf
user www-data;
worker_processes auto;
error_log /var/log/nginx/error.log debug;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}
謝謝你。
uj5u.com熱心網友回復:
嗯.. 最初我只是在 Laravel 方面尋找錯誤。我做了更多與 nginx 相關的調查并來到這個執行緒。
安裝 Nginx 后找不到 Laravel 路由
我跟著它,它奏效了。我修改后的 default.conf 如下:
server {
listen 443;
server_name starhardware.com.my;
root /var/www/app;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
index index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/531603.html
上一篇:502BadgatewayNginxreversyproxy,connect()failed(111:Connectionrefused)同時連接到上游
