谷姐:我们都是谷歌迷
We are all Google fans

求助Nginx 设置分流后,不能启动-祝MJJ财源广进

Rate this post

按教程 Nginx 设置分流后,不能启动。提示443被占用,改为4433还是被占用。
没有进程占用,用命令,宝塔安全选项,后台网络进程都没有占用。
把分流删掉,就可以启动。
自己看不出来问题,特此求助,感谢
*号为敏感字符

    userwww www;
    worker_processes auto;
    error_log/www/wwwlogs/nginx_error.logcrit;
    pid /www/server/nginx/logs/nginx.pid;
    worker_rlimit_nofile 51200;

    events
    {
    use epoll;
    worker_connections 51200;
    multi_accept on;
    }
    stream {
    # 这里就是 SNI 识别,将域名映射成一个配置名
    map $ssl_preread_server_name $backend_name {
    **30103.icu web;
    rn.**30103.icu tro***;
    # 域名都不匹配情况下的默认值
    default web;
    }

    # web,配置转发详情
    upstream web {
    server 127.0.0.1:4433;
    }

    # tro***,配置转发详情
    upstream tro*** {
    server 127.0.0.1:1112;
    }

    # 监听 443 并开启 ssl_preread
    server {
    listen 443 reuseport;
    listen [::]:443 reuseport;
    proxy_pass$backend_name;
    ssl_preread on;
    }
    }

    http
    {
    include mime.types;
    #include luawaf.conf;

    include proxy.conf;

    default_typeapplication/octet-stream;

    server_names_hash_bucket_size 512;
    client_header_buffer_size 32k;
    large_client_header_buffers 4 32k;
    client_max_body_size 50m;

    sendfile on;
    tcp_nopush on;

    keepalive_timeout 60;

    tcp_nodelay on;

    fastcgi_connect_timeout 300;
    fastcgi_send_timeout 300;
    fastcgi_read_timeout 300;
    fastcgi_buffer_size 64k;
    fastcgi_buffers 4 64k;
    fastcgi_busy_buffers_size 128k;
    fastcgi_temp_file_write_size 256k;
    fastcgi_intercept_errors on;

    gzip on;
    gzip_min_length1k;
    gzip_buffers 4 16k;
    gzip_http_version 1.1;
    gzip_comp_level 2;
    gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml;
    gzip_vary on;
    gzip_proxied expired no-cache no-store private auth;
    gzip_disable "MSIE [1-6]\.";

    limit_conn_zone $binary_remote_addr zone=perip:10m;
    limit_conn_zone $server_name zone=perserver:10m;

    server_tokens off;
    access_log off;

    server
    {
    listen 888;
    server_name phpmyadmin;
    index index.html index.htm index.php;
    root/www/server/phpmyadmin;
    location ~ /tmp/ {
    return 403;
    }

    #error_page 404 /404.html;
    include enable-php.conf;

    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
    expires 30d;
    }

    location ~ .*\.(js|css)?$
    {
    expires 12h;
    }

    location ~ /\.
    {
    deny all;
    }

    access_log/www/wwwlogs/access.log;
    }
    include /www/server/panel/vhost/nginx/*.conf;
    }

复制代码

补充1:
警告消息:

nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] still could not bind()

补充2:

网页配置

    server
    {
    listen 80;
    listen 4433 ssl http2;
    server_name rn.**30103.icu;
    index index.php index.html index.htm default.php default.htm default.html;
    root /www/wwwroot/rn.**30103.icu;

    #SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
    #error_page 404/404.html;
    #HTTP_TO_HTTPS_START
    if ($server_port !~ 4433){
    rewrite ^(/.*)$ https://$host$1 permanent;
    }
    #HTTP_TO_HTTPS_END
    ssl_certificate /www/server/panel/vhost/cert/rn.**30103.icu/fullchain.pem;
    ssl_certificate_key /www/server/panel/vhost/cert/rn.**30103.icu/privkey.pem;
    ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
    ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
    ssl_prefer_server_ciphers on;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;
    add_header Strict-Transport-Security "max-age=31536000";
    error_page 497https://$host$request_uri;

    #SSL-END

    #ERROR-PAGE-START错误页配置,可以注释、删除或修改
    #error_page 404 /404.html;
    #error_page 502 /502.html;
    #ERROR-PAGE-END

    #PHP-INFO-STARTPHP引用配置,可以注释或修改
    include enable-php-74.conf;
    #PHP-INFO-END

    #REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效
    include /www/server/panel/vhost/rewrite/rn.**30103.icu.conf;
    #REWRITE-END

    #禁止访问的文件或目录
    location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
    {
    return 404;
    }

    #一键申请SSL证书验证目录相关设置
    location ~ \.well-known{
    allow all;
    }

    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
    expires 30d;
    error_log off;
    access_log /dev/null;
    }

    location ~ .*\.(js|css)?$
    {
    expires 12h;
    error_log off;
    access_log /dev/null;
    }
    access_log/www/wwwlogs/rn.**30103.icu.log;
    error_log/www/wwwlogs/rn.**30103.icu.error.log;
    }
    server
    {
    listen 1116;
    server_name rn.**30103.icu;
    location / {

    if ($http_host !~ "^**30103.icu$") {
    rewrite^(.*) https://**30103.icu$1 permanent;
    }

    if ($server_port !~ 4433){
    rewrite ^(.*) https://**30103.icu$1 permanent;
    }

    proxy_redirect off;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    }
    access_log logs/aaa.com_access.log;
    }

复制代码

热议
2楼 【祝MJJ财源广进】

大佬们都没起床吗

∮⊱⊱⊱ 我们都有一个通病,和爱的人吵架,却和陌生人讲心里话。 ⊰⊰⊰∮

尾巴不止能用来挠痒痒
还能凑字数-不定时更新

3楼 【jmxct520】

报错发出来

4楼 【祝MJJ财源广进】

报错内容就是说443被占用,我后台查看 没有占用。 吧443改为4443一样提示4443被占用
我第一次搭建的时候,也是提示这个,忘记怎么搞定的。
就算我吧第一次的配置同样配置,只改域名。还是提示占用
警告消息:

nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] still could not bind()

5楼 【zzx396】

你是建站而且开SSL了吧,所以你的80 443已经被nginx用了,但是4443被占用就很神奇了。

6楼 【祝MJJ财源广进】

明明按照教程来操作。就是找不出问题。

7楼 【zzx396】

用的宝塔吧?安全里看看443是否显示未使用,如果显示正常,所有站点的443端口都需要偏移。

8楼 【祝MJJ财源广进】

443未使用 。为什么要偏移端口。

9楼 【ene】

lsof -i :4443 看一下是哪个占用4443

10楼 【shunglay】

v2和tr,哈哈哈扶墙...( _ _)ノ|

12楼 【ene】

那就试一下
lsof -i:443
看一下PID进程号
然后
kill -9 678(具体写 占用443 的PID)

13楼 【祝MJJ财源广进】

这么简单早就解决了,没有进程占用,用命令,宝塔安全选项,后台网络进程都没有占用这个端口。

14楼 【dunce】

检查一下include的.conf有没有绑定443

未经谷姐允许不得转载:谷姐靓号网 » 求助Nginx 设置分流后,不能启动-祝MJJ财源广进
分享到: 生成海报

热门文章

评论 抢沙发

评论前必须登录!

立即登录   注册

买Google Voice认准【谷姐靓号网】

Google Voice靓号列表Google Voice自助购买
切换注册

登录

忘记密码 ?

切换登录

注册

我们将发送一封验证邮件至你的邮箱, 请正确填写以完成账号注册和激活