折腾:
【已解决】更换WordPress网站的域名从之前xxx换到xxx.it
期间,前面已经wordpress搬家完成,且新建了host域名了,但是访问wordpress主页出错。
突然发现了,去访问:
好像生效了:
至少可以跳转了。
但是是旧的:
看来要去找其他原因
估计是nginx的配置?
[root@VM_0_10_centos wwwroot]# nginx -t nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful [root@VM_0_10_centos wwwroot]# cd /usr/local/nginx/ [root@VM_0_10_centos nginx]# ll total 36 drwx------ 2 www root 4096 Dec 6 2018 client_body_temp drwxr-xr-x 5 root root 4096 Dec 5 2018 conf drwx------ 12 www root 4096 Dec 7 2018 fastcgi_temp drwxr-xr-x 2 root root 4096 Dec 5 2018 html drwxr-xr-x 2 root root 4096 Dec 5 2018 logs drwx------ 2 www root 4096 Dec 5 2018 proxy_temp drwxr-xr-x 2 root root 4096 Dec 5 2018 sbin drwx------ 2 www root 4096 Dec 5 2018 scgi_temp drwx------ 2 www root 4096 Dec 5 2018 uwsgi_temp [root@VM_0_10_centos nginx]# cd conf/ [root@VM_0_10_centos conf]# ll total 88 -rw-r--r-- 1 root root 1077 Dec 5 2018 fastcgi.conf -rw-r--r-- 1 root root 1077 Dec 5 2018 fastcgi.conf.default -rw-r--r-- 1 root root 1007 Dec 5 2018 fastcgi_params -rw-r--r-- 1 root root 1007 Dec 5 2018 fastcgi_params.default -rw-r--r-- 1 root root 2837 Dec 5 2018 koi-utf -rw-r--r-- 1 root root 2223 Dec 5 2018 koi-win -rw-r--r-- 1 root root 5170 Dec 5 2018 mime.types -rw-r--r-- 1 root root 5170 Dec 5 2018 mime.types.default -rw-r--r-- 1 root root 2637 Dec 5 2018 nginx.conf -rw-r--r-- 1 root root 2656 Dec 5 2018 nginx.conf_bk -rw-r--r-- 1 root root 2656 Dec 5 2018 nginx.conf.default -rw-r--r-- 1 root root 484 Dec 5 2018 proxy.conf drwxr-xr-x 2 root root 4096 Dec 5 2018 rewrite -rw-r--r-- 1 root root 636 Dec 5 2018 scgi_params -rw-r--r-- 1 root root 636 Dec 5 2018 scgi_params.default drwxr-xr-x 2 root root 4096 May 9 20:12 ssl -rw-r--r-- 1 root root 664 Dec 5 2018 uwsgi_params -rw-r--r-- 1 root root 664 Dec 5 2018 uwsgi_params.default drwxr-xr-x 2 root root 4096 May 9 20:18 vhost -rw-r--r-- 1 root root 3610 Dec 5 2018 win-utf [root@VM_0_10_centos conf]# cd vhost/ [root@VM_0_10_centos vhost]# ll total 8-rw-r--r-- 1 root root 1486 May 9 20:18 www.xxx.it.conf -rw-r--r-- 1 root root 1217 Dec 5 2018 xxx.conf_backup [root@VM_0_10_centos vhost]# cat www.xxx.it.conf server { listen 80; listen 443 ssl http2; ssl_certificate /usr/local/nginx/conf/ssl/www.xxx.it.crt; ssl_certificate_key /usr/local/nginx/conf/ssl/www.xxx.it.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; ssl_ciphers TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5; ssl_prefer_server_ciphers on; ssl_session_timeout 10m; ssl_session_cache builtin:1000 shared:SSL:10m; ssl_buffer_size 1400; add_header Strict-Transport-Security max-age=15768000; ssl_stapling on; ssl_stapling_verify on; server_name www.xxx.it; access_log /data/wwwlogs/www.xxx.it_nginx.log combined; index index.html index.htm index.php; root /data/wwwroot/www.xxx.it; if ($ssl_protocol = "") { return 301 https://$host$request_uri; } include /usr/local/nginx/conf/rewrite/wordpress.conf; #error_page 404 /404.html; #error_page 502 /502.html; location ~ [^/]\.php(/|$) { #fastcgi_pass remote_php_ip:9000; fastcgi_pass unix:/dev/shm/php-cgi.sock; fastcgi_index index.php; include fastcgi.conf; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { expires 30d; access_log off; } location ~ .*\.(js|css)?$ { expires 7d; access_log off; } location ~ /(\.user\.ini|\.ht|\.git|\.svn|\.project|LICENSE|README\.md) { deny all; } } [root@VM_0_10_centos vhost]#
貌似没问题。
~ ping www.xxx.it PING xxx.it (xxx): 56 data bytes 64 bytes from xxx: icmp_seq=0 ttl=48 time=50.642 ms 64 bytes from xxx: icmp_seq=1 ttl=48 time=44.022 ms 64 bytes from xxx: icmp_seq=2 ttl=48 time=40.986 ms ^C --- xxx.it ping statistics --- 3 packets transmitted, 3 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 40.986/45.217/50.642/4.032 ms
ping没问题。
打算去phpmyadmin后台看看。
不过先去调试看看,发现问题了:
【已解决】wordpress主页出错:307 Internal Redirect和301 从磁盘缓存
即可解决问题。
核心是:
wordpress的mysql数据库中wp_options表中的siteurl和home值,确保是最新的域名
详见:
【已解决】wordpress主页出错:307 Internal Redirect和301 从磁盘缓存