Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The resolution process that the WordPress site cannot be accessed normally after changing the public network IP.

2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Production environment:

Operating system: CentOS release 6.8 (Final)

Web server software: Nginx-1.6.3.tar.gz

Database system: MySQL 5.5.52

PHP version: php 5.3.3

Site program: wordpress-4.7.4-zh_CN.tar.gz

MySQL database server: 113.195.210.*

Nginx server: 113.195.210.*

Description:

Http://117.40.239.8:8080/wordpress # Telecom IP

Http://113.195.210.150:8080/wordpress/ # changed from Telecom IP to Unicom IP

1. After changing from China Telecom to Unicom ip, the MySQL host of the wp-config.php file needs to change the DB IP, otherwise there will be an error in connecting to the database.

[root@Cacti wordpress] # vi wp-config.php

/ / * * MySQL settings-specific information comes from the host you are using * * / /

/ * * name of WordPress database * /

Define ('DB_NAME',' wordpress')

/ * * MySQL database user name * /

Define ('DB_USER',' * *)

/ * * MySQL database password * /

Define ('DB_PASSWORD',' * *)

/ * * MySQL host * /

Define ('DB_HOST',' 113.195.210.percent')

/ * default text encoding when creating a datasheet * /

Define ('DB_CHARSET',' utf8')

two。 After the IP is replaced, the following also occurs:

Figure 1: abnormal display and disordered layout of the website

3. Need to change the site url and home page of worpress

Mysql > use wordpress; # wp_options operation on the table after opening the database

Mysql > select * from wp_options whereoption_value like '7.40.239.8%'

+-+ +

| | option_id | option_name | option_value | autoload | |

+-+ +

| | 1 | siteurl | http://117.40.239.8:8080/wordpress | yes | |

| | 2 | home | http://117.40.239.8:8080/wordpress | yes | |

+-+ +

2 rows in set (0.01sec)

Method 1: change the site IP

Mysql > update wp_options

Set option_value=replace (option_value,'117.40.239.8','113.195.210.150') where option_value LIKE '7.40.239.8%'

Method 2: change the site IP

Mysql > update wp_options set option_value=' http://113.195.210.150:8080/wordpress' where option_name=' siteurl' or option_name='home'

Mysql > update wp_options set option_value=replace (option_value,'117.40.239.8','113.195.210.150') where option_value LIKE '7.40.239.8%'

Query OK, 2 rowsaffected (0.04 sec)

Rows matched:2 Changed: 2 Warnings: 0

Mysql > select * from wp_options where option_value like '3.195.210.150%'

+-+ +

| | option_id | option_name | option_value | autoload | |

+-+ +

| | 1 | siteurl | http://113.195.210.150:8080/wordpress | yes | |

| | 2 | home | http://113.195.210.150:8080/wordpress| yes |

+-+ +

2 rows in set (0.01sec)

The whole key to solving this problem is to change the site url and home page, otherwise the site content will not be displayed properly and the site will not be managed.

Technical explanation: if the author binds a public network IP address to a domain name, the client (user) can access it through the domain name, regardless of what IP address is behind it, and the user will not feel the change of IP address.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report