Nginx 不再啟動。此錯誤在存盤空間用完后開始發生。這個錯誤以前沒有發生過,我沒有更改配置。我知道還有很多其他問題有同樣的錯誤,但沒有一個有幫助。
這是我的 nginx 配置
server {
listen 80;
listen [::]:80;
server_name <domain>;
root /var/www/pterodactyl/public;
index index.html index.htm 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; }
access_log off;
error_log /var/log/nginx/pterodactyl.app-error.log error;
# allow larger file uploads and longer script runtimes
client_max_body_size 100m;
client_body_timeout 120s;
sendfile off;
location ~ \.php$ {
fastcgi_split_path_info ^(. \.php)(/. )$;
fastcgi_pass unix:<php_socket>;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param PHP_VALUE "upload_max_filesize = 100M \n post_max_size=100M";
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTP_PROXY "";
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
}
location ~ /\.ht {
deny all;
}
}
這是輸出nginx -T
nginx: [emerg] "server" directive is not allowed here in /etc/nginx/nginx.conf:1
nginx: configuration file /etc/nginx/nginx.conf test failed
uj5u.com熱心網友回復:
這不是一個 nginx 組態檔,而是一個虛擬主機組態檔,應該放置在/etc/nginx/conf.d
(或者/etc/nginx/sites-enabled
如果您更喜歡這種型別的虛擬主機組態檔組織;請參閱站點可用與站點啟用與 conf.d 目錄中的差異)執行緒ServerFault 找出差異)目錄。您可以在 nginx GitHub 鏡像中查看整個 nginx 組態檔示例。
這些 vhost 組態檔通常包含在http
配置級別的主組態檔中:
http {
...
include /etc/nginx/conf.d/*.conf;
}
并且基于 Debian 的軟體包(或使用這些sites-enabled
/sites-available
目錄的任何其他軟體包)在那里有一行:
http {
...
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
要為您的特定 Ubuntu 發行版查找原始nginx.conf
檔案,請下載相應的nginx-common
軟體包并檢查其內容。
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/494616.html
上一篇:Firebase-現有用戶登錄后是否應該洗掉匿名UID?
下一篇:垂直時如何正確對齊字串?