首先,让我说我是nginx的新手,我还没有达到我能够自己诊断问题的那一点。所以我希望你们其中一个人能够帮助我!
我有一个运行nginx和以下文件的VPS,但后来我删除已安装的操作系统并重新安装Arch Linux。它正在使用THIS EXACT配置文件(nginx.conf),现在我重新安装了VPS并重新上载了相同的conf文件(我在重新安装之前做了备份)它拒绝工作。当我“sudo systemctl restart nginx
”时,它会给我以下错误:"Job for nginx.service failed. See 'systemctl status nginx.service' and 'journalctl -xn' for details."
这是我所指的conf文件:
#user html;
worker_processes 4;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include 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 logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm index.php;
}
#error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
root /usr/share/nginx/html;
include fastcgi.conf;
}
location ~ /\.ht {
deny all;
}
}
server {
listen 80;
server_name www.brackishmedia.com brackishmedia.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /usr/share/nginx/brackishmedia.com/html;
index index.html index.htm index.php;
}
#error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
root /usr/share/nginx/brackishmedia.com/html;
include fastcgi.conf;
}
location ~ /\.ht {
deny all;
}
}
include /usr/share/nginx/rescuechurchmiami.com/conf/*;
}
如果删除以下部分:
server {
listen 80;
server_name www.brackishmedia.com brackishmedia.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /usr/share/nginx/brackishmedia.com/html;
index index.html index.htm index.php;
}
#error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
root /usr/share/nginx/brackishmedia.com/html;
include fastcgi.conf;
}
location ~ /\.ht {
deny all;
}
}
include /usr/share/nginx/rescuechurchmiami.com/conf/*;
并做一个sudo systemctl restart nginx
,它完美无缺。但是,我需要那些其他服务器阻塞的那些,include /usr/share/nginx/rescuechurchmiami.com/conf/*;
转到专门用于WordPress安装的配置文件。
所以这些是我遇到的问题。有关修复它的任何建议吗?我甚至不明白为什么它不会像以前的VPS一样工作。
谢谢你, AJ