我一直在尝试使用nginx作为我的服务器安装flarum但是当我重新启动nginx时我会遇到多个问题,如果有人能说出我哪里出错了我真的很感激它
when i run "systemctl restart nginx" this happens
nginx.service的作业失败,因为控制进程退出并显示错误代码 . 有关详细信息,请参阅“systemctl status nginx.service”和“journalctl -xe” .
then when i run "nginx -t -c /etc/nginx/nginx.conf" this happens
nginx:[emerg] / etc / nginx / sites-enabled / creativethoughts中的重复位置“/”:14 nginx:配置文件/etc/nginx/nginx.conf测试失败
Heres what I have done since i last restarted nginx
创建一个新的站点可用文件,然后将其复制到站点 - 使用“sudo ln -s / etc / nginx / sites-available / creativethoughts / etc / nginx / sites-enabled /”
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www/html;
index index.html index.htm;
server_name forums.creativethoughts.us www.forums.creativethoughts.us;
location / {
try_files $uri $uri/ =404;
}
location / { try_files $uri $uri/ /index.php?$query_string; }
location /api { try_files $uri $uri/ /api.php?$query_string; }
location /admin { try_files $uri $uri/ /admin.php?$query_string; }
location /flarum {
deny all;
return 404;
}
location ~* \.php$ {
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTP_PROXY ""; # Fix for https://httpoxy.org/ vulnerability
fastcgi_index index.php;
}
location ~* \.html$ {
expires -1;
}
location ~* \.(css|js|gif|jpe?g|png)$ {
expires 1M;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
gzip on;
gzip_http_version 1.1;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied any;
gzip_types application/atom+xml
application/javascript
application/json
application/vnd.ms-fontobject
application/x-font-ttf
application/x-web-app-manifest+json
application/xhtml+xml
application/xml
font/opentype
image/svg+xml
image/x-icon
text/css
text/plain
text/xml;
gzip_buffers 16 8k;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
}
--------------------------------------------------
编辑了nginx.conf并从“server_names_hash_bucket_size 64;”中删除了注释
终于试图重启并得到错误
1 回答
您要两次指定
/
位置 .您已多次声明gzip指令 .
您没有关闭服务器块 .
这是固定的: