nginx+wordpress返回的页面链接为IP(wordpress 更改更换域名)
貌似很少有人遇到这个问题:http://blog.77hz.cn/,文章的链接都是IP。配置如下,兄弟们给看看:
server {
listen 80;
server_nameblog.77hz.cn;
root/home/wwwroot/wordpress;
#charset koi8-r;
access_log/home/wwwlogs/access.logaccess;
include wordpress.conf;
location ~ .*.(php|php5)?$
{
try_files $uri =404;
fastcgi_passunix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*.(js|css)?$
{
expires 12h;
}
#error_page404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504/50x.html;
location = /50x.html {
root 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$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_indexindex.php;
# fastcgi_paramSCRIPT_FILENAME/scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /.ht {
# denyall;
#}
}
回复 1# 的帖子
现在用以下的配置先搞定了,想问下有没有方法不用加下面的配置也可以sub_filter 115.29.243.174 'blog.77hz.cn';
sub_filter_once off; 你那是用ip安装的wordpress吧
回复 3# 的帖子
对,对wp不是很了解,想不到还跟这个有关,谢谢提醒。 找到wp-config.php,在wp-config.php中,添加:define('WP_HOME','https://www.vpser.net');
define('WP_SITEURL','https://www.vpser.net');
其中www.vpser.net替换为你的域名
或用下面的这个
define('RELOCATE',true);
登陆wp后台,设置->常规 中 更新成你的新域名
最后都要删除在wp-config.php中刚才添加的内容。
页:
[1]