我想啓動我的nginx服務器。 當我輸入「$> /etc/init.d/nginx start」時,我有一條消息出現「Starting nginx:」,然後沒有任何反應。沒有錯誤信息,當我檢查nginx的狀態時,我發現它沒有運行。Nginx沒有運行沒有錯誤信息
這裏是我的/etc/nginx/nginx.conf文件:
worker_processes 4;
daemon off;
error_log /home/vincent/tmp/nginx.log;
pid /home/vincent/tmp/nginx.pid;
events {
worker_connections 1024;
}
http {
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 /home/vincent/tmp/access.log main;
sendfile on;
keepalive_timeout 65;
include /etc/nginx/site-enabled/*;
}
這裏是我的/ etc/nginx的/網站可用/默認文件:
server {
listen 80;
server_name technical-test.neo9.lan;
access_log /var/log/nginx/technical-test.neo9.lan.log main;
set $home /home/vincent;
location/{
alias $home/neo9/web/app/;
index index.html;
}
location /api/ {
rewrite ^/api/(.*)$ /$1 break;
proxy_pass http://localhost:1234;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
你嘗試'服務nginx的configtest'? –
使用此命令給我這個答案:「測試nginx配置:nginx」。 – user2618928
而「sudo nginx -t」給了我:nginx:配置文件/etc/nginx/nginx.conf語法正常 nginx:配置文件/etc/nginx/nginx.conf測試成功 – user2618928