Raf*_*tro 9 nginx raspbian raspberry-pi3
我是nginx和Raspberry的新手.
我用nginx安装了
sudo apt-get install
那一切都很好.当我尝试重新启动nginx时问题出现了,它抛出了这个错误
nginx.service的作业失败.有关详细信息,请参阅"systemctl status ngins.service"和"journaldtl -xn"
调查后我发现问题是下一个错误:
意外的文件结束,期待";" 或/ etc/nginx/sites-enabled/default中的"}":20
我的默认文件是:
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
server {
#listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6
listen 80;
server_name $domain_name;
root /var/www;
index index.html index.htm;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
# Make site accessible from http://localhost/
server_name localhost;
location /
Run Code Online (Sandbox Code Playgroud)
我希望你能帮帮我 :)
Rob*_*man 17
我的问题是由于缺少 a;作为命令行参数之一的一部分。
以下是我的日志供参考:
2020/08/11 17:19:25 [emerg] 1#1: unexpected end of parameter, expecting ";" in command line
nginx: [emerg] unexpected end of parameter, expecting ";" in command line
Run Code Online (Sandbox Code Playgroud)
我的错误是我通过 dockernginx从以下内容开始CMD:
CMD ["nginx", "-g", "daemon off"]
Run Code Online (Sandbox Code Playgroud)
我错过了尾随的地方;。我应该拥有的是:
CMD ["nginx", "-g", "daemon off;"]
Run Code Online (Sandbox Code Playgroud)
以防万一它可以帮助其他人。
正如@Thanh Nguyen Van 已经回答了。将location必须被打开,并在大括号关闭,然后又花括号为您的服务器端
server {
#listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6
listen 80;
server_name $domain_name;
root /var/www;
index index.html index.htm;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
# Make site accessible from http://localhost/
server_name localhost;
location / {
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
26545 次 |
| 最近记录: |