오류 메시지없이 Nginx가 실행되지 않음
내 nginx 서버를 시작하려고합니다. "$> /etc/init.d/nginx start"를 입력하면 "Starting 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 / sites-available / default 파일이 있습니다.
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;
}
}
첫째, 항상 sudo nginx -t
구성 파일이 좋은지 확인하십시오.
I ran into the same problem. The reason I had the issue was twofold. First, I had accidentally copied a log file into my site-enabled folder. I deleted the log file and made sure that all the files in sites-enabled were proper nginx site configs. I also noticed two of my virtual hosts were listening for the same domain. So I made sure that each of my virtual hosts had unique domain names.
sudo service nginx restart
Then it worked.
You should probably check for errors in /var/log/nginx/error.log
.
In my case I did no add the port for ipv6. You should also do this (in case you are running nginx on a port other than 80): listen [::]:8000 default_server ipv6only=on;
Check the daemon option in nginx.conf file. It has to be ON. Or you can simply rip out this line from config file. This option is fully described here http://nginx.org/en/docs/ngx_core_module.html#daemon
In your /etc/nginx/nginx.conf
file you have:
include /etc/nginx/site-enabled/*;
And probably the path you are using is:
/etc/nginx/sites-enabled/default
Notice the missing s in site.
One case you check that nginx hold on 80 number port in system by default , check if you have any server like as apache or anything exist on system that block 80 number port thats the problem occurred.
1 .You change port number on nginx by this way,
sudo vim /etc/nginx/sites-available/default
Change 80 to 81 or anything,
- Check everything is ok by ,
sudo nginx -t
- Restart server
sudo service nginx start
- Check the status of nginx:
sudo service nginx status
Hope that will work
I had the exact same problem with my instance. My problem was that I forgot to allow port 80 access to the server. Maybe that's your issue as well?
Check with your WHM and make sure that port is open for the IP address of your site,
For what it's worth: I just had the same problem, after editing the nginx.conf
file. I tried and tried restarting it by commanding sudo nginx restart
and various other commands. None of them produced any output. Commanding sudo nginx -t
to check the configuration file gave the output sudo: nginx: command not found
, which was puzzling. I was starting to think there were problems with the path.
Finally, I logged in as root (sudo su
) and commanded sudo nginx restart
. Now, the command displayed an error message concerning the configuration file. After fixing that, it restarted successfully.
1. Check for your configuration files by running the aforementioned command: sudo nginx -t
.
2. Check for port conflicts. For instance, if apache2 (ps waux | grep apache2
) or any other service is using the same ports configured for nginx (say port 80) the service will not start and will fail silently (err... the cousin of my friend had this problem...)
참고URL : https://stackoverflow.com/questions/17859653/nginx-not-running-with-no-error-message
'Nice programing' 카테고리의 다른 글
App.settings-Angular 방식? (0) | 2020.12.02 |
---|---|
PyCharm의 숨겨진 기능 (0) | 2020.12.02 |
Thread.SpinWait 메서드의 목적은 무엇입니까? (0) | 2020.12.02 |
Android ImageView 애니메이션 (0) | 2020.12.02 |
WPF ComboBox에서 선택한 항목에 드롭 다운 부분의 항목과 다른 템플릿을 사용할 수 있습니까? (0) | 2020.12.01 |