怎么打开 1panel 安装的 OpenResty 的管理页面?

我是用 1panel 安装了一个 OpenResty

但是点击服务端80 显示 404

图片.png

那说明需要配置一下,但是怎么配置呢?OpenResty 有配套的页面管理地址吗?端口是多少?或者说怎么在 1panel 中打开

阅读 437
1 个回答

这个问题我解决了,因为 1panel 安装的 OpenResty 只能以 127.0.0.1 访问,才能显示欢迎界面

server_name 限制了 127.0.0.1

╭─pon@volc4 /opt/1panel/apps/openresty/openresty/conf  
╰─➤  pwd
/opt/1panel/apps/openresty/openresty/conf
╭─pon@volc4 /opt/1panel/apps/openresty/openresty/conf  
╰─➤  cat conf.d/default.conf
server {
    listen        80 ;
    server_name   127.0.0.1;
    charset       utf-8;
    default_type  text/html;

    location ~ /.well-known/acme-challenge {
        allow all;
        root /usr/share/nginx/html;
    }

    location /nginx_status {
        stub_status   on;
        access_log   off;
    }

    root /usr/share/nginx/html;
}

访问后的效果

─➤  http http://127.0.0.1                                                                                                                                                                                                                                                                              130 ↵
HTTP/1.1 200 OK
Accept-Ranges: bytes
Connection: keep-alive
Content-Length: 732
Content-Type: text/html; charset=utf-8
Date: Thu, 17 Apr 2025 07:44:35 GMT
ETag: "67e54a3a-2dc"
Last-Modified: Thu, 27 Mar 2025 12:53:14 GMT
Server: openresty

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>恭喜,站点创建成功!</title>
    <style>
        .container {
            width: 60%;
            margin: 10% auto 0;
            background-color: #f0f0f0;
            padding: 2% 5%;
            border-radius: 10px
        }

        ul {
            padding-left: 20px;
        }

        ul li {
            line-height: 2.3
        }

        a {
            color: #20a53a
        }
    </style>
</head>
<body>
<div class="container">
    <h1>恭喜, 站点创建成功!</h1>
    <h3>这是默认index.html,本页面由系统自动生成</h3>
    <ul>
        <li>您可以修改、删除或覆盖本页面</li>
    </ul>
</div>
</body>
</html>

其他的就是 404 了

╰─➤  ll conf.d/00.default.conf 
 inode Permissions Links Size Blocks User Group Date Modified Name
669087 .rw-r--r--      1  299      8 root root  27 Mar 20:53  conf.d/00.default.conf
╭─pon@volc4 /opt/1panel/apps/openresty/openresty/conf  
╰─➤  ll                       
 inode Permissions Links Size Blocks User Group Date Modified Name
669086 drwxr-xr-x      2    -      - root root  17 Apr 16:11  conf.d
669089 .rw-r--r--      1  428      8 root root  27 Mar 20:53  fastcgi-php.conf
669090 .rw-r--r--      1  990      8 root root  27 Mar 20:53  fastcgi_params
669085 .rw-r--r--      1 5.3k     16 root root  27 Mar 20:53  mime.types
669084 .rw-r--r--      1 1.3k      8 root root  27 Mar 20:53  nginx.conf
╭─pon@volc4 /opt/1panel/apps/openresty/openresty/conf  
╰─➤  cat conf.d/00.default.conf 
map "" $empty {
        default "";
}

server
{
    listen 80;
    listen 443 ssl http2;
    server_name _;

    ssl_ciphers aNULL;
    ssl_certificate data:$empty;
    ssl_certificate_key data:$empty;
    ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;

    index 404.html;
    root /usr/share/nginx/html;
}
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题