nginx: [emerg] bind() to 0.0.0.0:38022 failed (48: Address already in use) nginx: [emerg] bind() to 0.0.0.0:38022 failed (48: Address already in use) nginx: [emerg] bind() to 0.0.0.0:38022 failed (48: Address already in use) nginx: [emerg] bind() to 0.0.0.0:38022 failed (48: Address already in use) nginx: [emerg] bind() to 0.0.0.0:38022 failed (48: Address already in use) nginx: [emerg] still could not bind()
这个怎么解决我换了几个接口也是一样的
1
lizhimiao 2018-03-27 15:33:23 +08:00
把配置文件贴出来看看.
|
2
hadoop 2018-03-27 15:34:26 +08:00
sudo lsof -i :38022 看下端口被谁占用了呗
|
4
caixuanxu OP @lizhimiao
#user nobody; worker_processes 1; #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 38022; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location /a { root html; index index.html index.htm; proxy_pass http://localhost:28080; } #location /apis { #rewrite ^.+apis/?(.*)$ /$1 break; #include uwsgi_params; #proxy_pass http://localhost:28080; #} #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} include servers/*; } |
6
ik 2018-03-27 15:38:42 +08:00 via iPhone
这是用的 restart 吧? killall nginx 再启动呢?
|
9
lizhimiao 2018-03-27 15:45:10 +08:00
include servers/*;
这个目录下有配置文件吗? |
12
ik 2018-03-27 15:55:24 +08:00
企鹅: MTA1NDc1Nzk=
渣渣一个,不一定能解决哈.... 看 #10 的回复, 我觉得你应该把 #8 这个问题搞明白, nginx 有守护进程? |
14
menghuan 2018-03-27 15:58:55 +08:00
你的 nginx 启动脚本有问题吧 重启时候没有杀死之前的进程
|
16
ik 2018-03-27 16:04:36 +08:00
@caixuanxu
``` 1. ps 命令 先记下 nginx 主进程的 PID 2. killall nginx 3. 再 ps 看下是否有 nginx 主进程 PID 是否一致, 要是一致说明没有 kill 掉, 要是不一样, 那可能是有守护进程已经重启了, 可以试试新配置是否生效 ``` |
21
vindurriel 2018-03-27 17:15:51 +08:00 via iPhone
配置贴全了嘛 include servers/* 这里有吗?
|
22
csl1995 2018-03-27 17:26:31 +08:00
netstat -nlp|grep
kill 9 pid systemctl restart nginx |