Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

配置多域名不会生效 #594

Open
ketianlin opened this issue Jun 18, 2024 · 3 comments
Open

配置多域名不会生效 #594

ketianlin opened this issue Jun 18, 2024 · 3 comments

Comments

@ketianlin
Copy link

在services/nginx/conf.d/test.cn.conf配置这个文件,内容如下
server {
listen 80;
server_name test.cn;
root /www/test.cn;
index index.php index.html index.htm;

access_log /dev/null;
error_log  /var/log/nginx/nginx.test.cn.error.log  warn;

error_page   500 502 503 504  /50x.html;
location = /50x.html {
    root   /usr/share/nginx/html;
}

location ~ [^/]\.php(/|$) {
    fastcgi_pass   php80:9000;
    include        fastcgi-php.conf;
    include        fastcgi_params;
}

}
然后在www的目录下面有一个test.cn的目录,里面就是一个index.php
hosts也配置了,localhost test.cn
docker exec -it nginx nginx -t 没有问题
docker exec -it nginx nginx -s reload 也重启了
但是范围的时候提示502

该网页无法正常运作test.cn
目前无法处理此请求。
HTTP ERROR 502

大佬可以帮忙看看吗

@afu727
Copy link

afu727 commented Jun 18, 2024 via email

@jeeinn
Copy link
Contributor

jeeinn commented Jun 21, 2024

试试把日志调整为info或debug级别,nginx和php-fpm的日志都看一看应该就能找到问题

@xianggau
Copy link

xianggau commented Aug 2, 2024

2024/08/02 16:31:02 [error] 20#20: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.0.1, server: www.re.com, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://192.168.0.5:9000", host: "localhost"
`server {
listen 80;
server_name www.re.com;
root /www/localhost;
index index.php index.html index.htm;
#charset koi8-r;

access_log /dev/null;
#access_log  /var/log/nginx/nginx.localhost.access.log  main;
error_log  /var/log/nginx/nginx.re.error.log  warn;

#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   /usr/share/nginx/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(/|$) {
    fastcgi_pass   php:9000;
    include        fastcgi-php.conf;
    include        fastcgi_params;
}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
#    deny  all;
#}
location / {
    try_files $uri $uri/ /index.php?$query_string;
}

}

` 同样的问题,我配置了多域名访问502。host是设置成功的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants