Tôi đang cố khởi động máy chủ nginx của mình. Khi tôi nhập "$> /etc/init.d/nginx start", tôi có một thông báo xuất hiện "Starting nginx:", và sau đó không có gì xảy ra. Không có thông báo lỗi và khi tôi kiểm tra trạng thái của nginx, tôi thấy rằng nó không chạy.Nginx không chạy không có thông báo lỗi
Đây là tập tin /etc/nginx/nginx.conf tôi:
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/*;
}
Và đây là tập tin/etc/nginx/sites-available/default của tôi:
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;
}
}
Bạn đã thử 'dịch vụ nginx configtest'? –
Sử dụng lệnh này cho tôi câu trả lời này: "Kiểm tra cấu hình nginx: nginx." – user2618928
Và "sudo nginx -t" cho tôi: nginx: tập tin cấu hình /etc/nginx/nginx.conf là ok nginx: tập tin cấu hình /etc/nginx/nginx.conf test thành công – user2618928