By elearn
The wordpress is been built on nginx ,the port is 8080 ,it can be visited at the form of
http://127.0.0.1:8080/wp/?p=4.
In my wordpress database:
select guid from wp_posts limit 2 ;
+-------------------------------+
| guid |
+-------------------------------+
| http://127.0.0.1:8080/wp/?p=4 |
| http://127.0.0.1:8080/wp/?p=8 |
+-------------------------------+
Now i want to change the port of nginx from 8080 into 80.
1.edit /etc/nginx/nginx.conf from
server {
listen 8080;
server_name localhost;
#irrelated content omitted
into
server {
listen 80;
server_name localhost;
2.edit /var/www/html/wp/wp-config.php
from
define('WP_SITEURL','http://localhost:8080/wp/');
define('WP_HOME','http://localhost:8080/wp/');
into
define('WP_SITEURL','http://localhost:80/wp/');
define('WP_HOME','http://localhost:80/wp/');
3.login into my wordpress database to execute the sql commands.
UPDATE wp_posts SET post_content = replace(post_content, 'http://127.0.0.1:8080/wp', 'http://127.0.0.1/wp');
UPDATE wp_options SET option_value = replace(option_value, 'http://127.0.0.1:8080/wp', 'http://127.0.0.1/wp');
UPDATE wp_posts SET guid = replace(guid, 'http://127.0.0.1:8080/wp', 'http://127.0.0.1/wp');
UPDATE wp_posts SET pinged = replace(pinged, 'http://127.0.0.1:8080/wp', 'http://127.0.0.1/wp');
update wp_options set option_value='http://localhost:80' where option_name='siteurl';
update wp_options set option_value='http://localhost:80' where option_name='home';
Now restart ngix.
service nginx restart
when i input http://127.0.0.1:80/wp/?p=4 in the browser.
http://i.stack.imgur.com/buZrc.png
Where the problem appear?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
I would suggest looking your error logs to see the problem, also if your site is running on port 80 you do not need to put :80 to access your site, it will default to 80.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.