我认为一切都设置正确,但当我测试nginx服务器时,我遇到了一个错误



我第一次尝试设置nginx服务器来部署laravel应用程序。

我已经完成了所需的每一步,安装php、mysql、composer-ecc-

然后我创建如下配置文件:

server {
listen 80;
server_name 142.93.111.117;
root /var/www/colosseo60/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico {return 204; access_log off; log_not_found of
f; }
location = /robots.txt { access_log off; log_not_found of
f; }
error_page 404 /index.php;
location ~ .php$ {
fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_s
cript_name;
include fastcgi_params;
}
location ~ /.(?!well-known).* {
deny all;
}
}

然后我也在目录sites-enabled中创建它的副本

但是当我试图测试我的nginx服务器是否正常工作时(sudo nginx -t(,我得到了这个错误:

nginx: [emerg] invalid number of arguments in "log_not_found" directive in /etc/nginx/sites-enabled/colosseo60:19
nginx: configuration file /etc/nginx/nginx.conf test failed

现在我已经花了大约4个小时的时间试图找到这个错误的解决方案,但我似乎找不到任何关于网络的信息。

有人能帮我处理这件事吗?

如果有人认为这是一个简单的问题,我很抱歉,但我完全不懂,我快疯了。

非常感谢

[SOLVED]错误是由于每个函数都是从VIM编辑器中自动剪切的。

我解决了在配置文件中执行以下操作的问题:

server {
listen 80;
server_name 142.93.111.117;
root /var/www/colosseo60/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico {
return 204;
access_log off;
log_not_found off; }

location = /robots.txt {
access_log off;
log_not_found off; }
error_page 404 /index.php;
location ~ .php$ {
fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /.(?!well-known).* {
deny all;
}
}

相关内容

最新更新