云服务器安装nginx,配置成反向代理。可以访问代理后面的服务wordpress,但是浏览器的地址栏显示的不是域名,而是localhost,并且网站内的链接都是localhost。
nginx的配置文件:
server {
listen 443 ssl;
location / {
proxy_pass http://localhost:8000;
}
server {
listen 8000;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
ffastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
}
输入域名可以显示主页 https://www.yiming.com/
但是进入其他页面的时候,浏览器的地址栏显示的是 localhost:8000/abc.php
首页显示:
其他页显示: