Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/261.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我的php应用程序面临nginx.conf问题_Php_Nginx_Debian_Nginx Config_Nginx Location - Fatal编程技术网

我的php应用程序面临nginx.conf问题

我的php应用程序面临nginx.conf问题,php,nginx,debian,nginx-config,nginx-location,Php,Nginx,Debian,Nginx Config,Nginx Location,我正试图在nginx中为我的php应用程序配置http服务器,但是当我尝试启动服务时,如果有人能够帮助的话,就会出现这个错误 使用命令启动服务时出现的跟踪错误 -- Subject: Unit nginx-rtmp.service has begun reloading its configuration -- Defined-By: systemd -- Support: https://www.debian.org/support -- -- Unit nginx-rtmp.service

我正试图在nginx中为我的php应用程序配置http服务器,但是当我尝试启动服务时,如果有人能够帮助的话,就会出现这个错误

使用命令启动服务时出现的跟踪错误

-- Subject: Unit nginx-rtmp.service has begun reloading its configuration
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- Unit nginx-rtmp.service has begun reloading its configuration
Nov 22 15:54:43 chandu nginx[19339]: nginx: [emerg] pattern "^(.+\.php)(/.*)chr(36)" must have 2 captures in /opt/nginx-rtmp/conf/nginx.conf:38
Nov 22 15:54:43 chandu systemd[1]: nginx-rtmp.service: Control process exited, code=exited status=1
Nov 22 15:54:43 chandu systemd[1]: Reload failed for Nginx RTMP.
-- Subject: Unit nginx-rtmp.service has finished reloading its configuration
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- Unit nginx-rtmp.service has finished reloading its configuration
-- 
-- The result is failed.
lines 1256-1284/1284 (END)
我的nginx.conf文件 以下是我的nginx.conf文件fastcgi_split_path_info^(+.php)(/.*)chr(36);在第38行,错误指向上面

user nginx;
worker_processes 2;
pid /run/nginx-rtmp.pid;
error_log logs/error.log;

events {
    worker_connections 1024;
}

rtmp {
    server {
        listen 1935;
    }
}

http {
    access_log logs/access.log;
    include mime.types;

    server {
        listen 26765;
        location /stat {
            rtmp_stat all;
        }
    }

    server {
        listen 80;

        root /opt/panel/public;

        location / {
            try_files chr(36)uri /index.phpchr(36)is_argschr(36)args;
        }

        location ~ ^/index\.php(/|chr(36)) {
            fastcgi_pass 127.0.0.1:9000;
                fastcgi_split_path_info ^(.+\.php)(/.*)chr(36);
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME chr(36)realpath_rootchr(36)fastcgi_script_name;
                fastcgi_param DOCUMENT_ROOT chr(36)realpath_root;
                internal;
            }
        location ~ \.phpchr(36) {
            return 404;
        }       
    }
}
nginx-rtmp.service文件 这是为启动nginx服务器而创建的我的服务

[Unit]
Description=Nginx RTMP
After=syslog.target network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/run/nginx-rtmp.pid
ExecStartPre=/opt/nginx-rtmp/sbin/nginx -t
ExecStart=/opt/nginx-rtmp/sbin/nginx
ExecReload=/opt/nginx-rtmp/sbin/nginx -s reload
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target
更新的nginx.config服务已启动,但在浏览器上打开应用程序时出现502错误网关错误

user nginx;
worker_processes 2;
pid /run/nginx-rtmp.pid;
error_log logs/error.log;

events {
    worker_connections 1024;
}

rtmp {
    server {
        listen 1935;
    }
}

http {
    access_log logs/access.log;
    include mime.types;

    server {
        listen 26765;
        location /stat {
            rtmp_stat all;
        }
    }

    server {
        listen 80;

        root /opt/panel/public;

        location / {
            try_files $uri /index.php$is_args$args;
        }

        location ~ ^/index\.php(/|$) {
            fastcgi_pass 127.0.0.1:9000;
                fastcgi_split_path_info ^(.+\.php)(/.*)$;
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
                fastcgi_param DOCUMENT_ROOT $realpath_root;
                internal;
            }
        location ~ \.php$ {
            return 404;
        }       
    }
}
php-fpm.conf数据

[global]
pid = /www/server/php/74/var/run/php-fpm.pid
error_log = /www/server/php/74/var/log/php-fpm.log
log_level = notice

[www]
listen = /tmp/php-cgi-74.sock
listen.backlog = 8192
listen.allowed_clients = 127.0.0.1
listen.owner = www
listen.group = www
listen.mode = 0666
user = www
group = www
pm = dynamic
pm.status_path = /phpfpm_74_status
pm.max_children = 150
pm.start_servers = 10
pm.min_spare_servers = 10
pm.max_spare_servers = 30
request_terminate_timeout = 100
request_slowlog_timeout = 30
slowlog = var/log/slow.log

我不知道您是如何做到这一点的,但是在nginx配置中,每个出现的
$
字符都会以某种方式更改为
chr(36)
。将每个
chr(36)
子字符串更改回
$
。好的,我更改了每个chr(36)子字符串返回到$,进程启动,但当我在浏览器中打开应用程序时,它给我的错误是502坏网关使用当前配置更新您的问题以使其可读。在问题结束时添加了更新的nginx.config您是否已安装、启动php fpm服务并实际侦听localhost TCP端口9000?对应的nginx错误日志消息是什么?我不知道您是如何做到这一点的,但在nginx配置中,每个出现的
$
字符都会以某种方式更改为
chr(36)
。将每个
chr(36)
子字符串更改回
$
。好的,我更改了每个chr(36)子字符串返回到$,进程启动,但当我在浏览器中打开应用程序时,它给我的错误是502坏网关使用当前配置更新您的问题以使其可读。在问题结束时添加了更新的nginx.config您是否已安装、启动php fpm服务并实际侦听localhost TCP端口9000?对应的nginx错误日志消息是什么?