1Panel icon indicating copy to clipboard operation
1Panel copied to clipboard

[BUG] PHP 配置被自动修改错误

Open AtlantisDe opened this issue 1 year ago • 5 comments

1Panel 版本

v1.10.6-lts

问题描述

我在测试你们PHP运行时,我使用本地的已经安装的PHP 8.3.6

//PHP 8.3.6 (cli) (built: Apr 15 2024 19:21:47) (NTS)

  • 站点 执行,停止,再启动.配置都被你们修改得没了.站点就没法工作了.

重现步骤

  • 站点 执行,停止,再启动.
#测试启动正常配置
server {
    listen 9996 ; 
    server_name php.test.com; 
    index index.php index.html index.htm default.php default.htm default.html; 
    proxy_set_header Host $host; 
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    proxy_set_header X-Forwarded-Host $server_name; 
    proxy_set_header X-Real-IP $remote_addr; 
    proxy_http_version 1.1; 
    proxy_set_header Upgrade $http_upgrade; 
    proxy_set_header Connection "upgrade"; 
    access_log /www/sites/phpMyAdmin/log/access.log; 
    error_log /www/sites/phpMyAdmin/log/error.log; 
    location ^~ /.well-known/acme-challenge {
        allow all; 
        root /usr/share/nginx/html; 
    }
    root /www/sites/phpMyAdmin/index; 
    location ~ [^/]\.php(/|$) {
        fastcgi_pass 127.0.0.1:9000; 
        include fastcgi-php.conf; 
        include fastcgi_params; 
        fastcgi_param SCRIPT_FILENAME /opt/1panel/apps/openresty/openresty/www/sites/phpMyAdmin/index/index.php; 
    }
}

# 停止 启动后配置 
server {
    listen 9996 ; 
    server_name php.test.com; 
    index index.php index.html index.htm default.php default.htm default.html; 
    proxy_set_header Host $host; 
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    proxy_set_header X-Forwarded-Host $server_name; 
    proxy_set_header X-Real-IP $remote_addr; 
    proxy_http_version 1.1; 
    proxy_set_header Upgrade $http_upgrade; 
    proxy_set_header Connection "upgrade"; 
    access_log /www/sites/phpMyAdmin/log/access.log; 
    error_log /www/sites/phpMyAdmin/log/error.log; 
    location ^~ /.well-known/acme-challenge {
        allow all; 
        root /usr/share/nginx/html; 
    }
    root /www/sites/phpMyAdmin/index; 
    include /www/sites/phpMyAdmin/proxy/*.conf; 
    location ~ [^/]\.php(/|$) {
        fastcgi_pass 127.0.0.1:9000; 
        include fastcgi-php.conf; 
        include fastcgi_params; 
        set $real_script_name $fastcgi_script_name; 
        if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
            set $real_script_name $1; 
            set $path_info $2; 
        }
        fastcgi_param SCRIPT_FILENAME $document_root$real_script_name; 
        fastcgi_param SCRIPT_NAME $real_script_name; 
        fastcgi_param PATH_INFO $path_info; 
    }
}

#  这些地方被修改了.
    include /www/sites/phpMyAdmin/proxy/*.conf; 
 location 

AtlantisDe avatar Apr 30 '24 14:04 AtlantisDe

本地 php 情况下,1panel 不会修改配置,提供一下完整的复现步骤以及截图,我们看看

zhengkunwang223 avatar Apr 30 '24 14:04 zhengkunwang223

本地 php 情况下,1panel 不会修改配置,提供一下完整的复现步骤以及截图,我们看看

看下配置 信息 我重新新建了站点,观察了下 配置文件的变化. 还有我补充下,这个应该不是 BT 影响吧,在安装你们的面板之前我安装了宝塔.实际上宝塔没有安装php环境.不知道跟这个有没影响,但是我已经成功配置你们 1panel面板 成功运行了 php的. 我使用的 TCP 9000 ..所以应该正常的.

AtlantisDe avatar Apr 30 '24 14:04 AtlantisDe

本地 php 情况下,1panel 不会修改配置,提供一下完整的复现步骤以及截图,我们看看

看下配置 信息 我重新新建了站点,观察了下 配置文件的变化. 还有我补充下,这个应该不是 BT 影响吧,在安装你们的面板之前我安装了宝塔.实际上宝塔没有安装php环境.不知道跟这个有没影响,但是我已经成功配置你们 1panel面板 成功运行了 php的.

我使用的 TCP 9000 ..所以应该正常的.

看起来不像是我们的问题,你是停止网站之后又打开了是吗

zhengkunwang223 avatar Apr 30 '24 14:04 zhengkunwang223

看起来不像是我们的问题,你是停止网站之后又打开了是吗

是的,新建站点后,然后,停止站点,再次启动,配置文件就发生改变了. 唯一我能猜测影响的,可能宝塔aaPanel 影响,但是这是什么具体原因引起的? 但是不应该,你们两个面板之间应该没啥联系可言,能影响的就是 端口的80占用问题.这些我都解决了.

这是你们 网站 停止 状态 你们自动修改的配置.

server {
    listen 9996 ; 
    server_name php.test.com; 
    index index.php index.html index.htm default.php default.htm default.html; 
    proxy_set_header Host $host; 
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    proxy_set_header X-Forwarded-Host $server_name; 
    proxy_set_header X-Real-IP $remote_addr; 
    proxy_http_version 1.1; 
    proxy_set_header Upgrade $http_upgrade; 
    proxy_set_header Connection "upgrade"; 
    access_log /www/sites/phpMyAdmin/log/access.log; 
    error_log /www/sites/phpMyAdmin/log/error.log; 
    location ^~ /.well-known/acme-challenge {
        allow all; 
        root /usr/share/nginx/html; 
    }
    root /usr/share/nginx/html/stop; 
}

AtlantisDe avatar Apr 30 '24 15:04 AtlantisDe

看起来不像是我们的问题,你是停止网站之后又打开了是吗

是的,新建站点后,然后,停止站点,再次启动,配置文件就发生改变了.

唯一我能猜测影响的,可能宝塔aaPanel 影响,但是这是什么具体原因引起的?

但是不应该,你们两个面板之间应该没啥联系可言,能影响的就是 端口的80占用问题.这些我都解决了.

这是你们 网站 停止 状态 你们自动修改的配置.


server {

    listen 9996 ; 

    server_name php.test.com; 

    index index.php index.html index.htm default.php default.htm default.html; 

    proxy_set_header Host $host; 

    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 

    proxy_set_header X-Forwarded-Host $server_name; 

    proxy_set_header X-Real-IP $remote_addr; 

    proxy_http_version 1.1; 

    proxy_set_header Upgrade $http_upgrade; 

    proxy_set_header Connection "upgrade"; 

    access_log /www/sites/phpMyAdmin/log/access.log; 

    error_log /www/sites/phpMyAdmin/log/error.log; 

    location ^~ /.well-known/acme-challenge {

        allow all; 

        root /usr/share/nginx/html; 

    }

    root /usr/share/nginx/html/stop; 

}

好的,我们先复现一下

zhengkunwang223 avatar Apr 30 '24 23:04 zhengkunwang223