简体   繁体   中英

Why is the local IP address rerouting in apache2?

I followed this tutorial to install a wordpress site:
https://ubuntu.com/tutorials/install-and-configure-wordpress#1-overview
It worked great. I never had an issue... Until I decided to move the virtual server to a new network. DHCP established a new IP address on the new network, and I can ping from other devices successfully.
But, when I type in the new IP address into the browser, it redirects to the old IP address, and after about 2 minutes it says that it's unreachable. Even when I put it incognito and did a DNS flush. I've tried modifying my .htaccess but that didn't work.

My /etc/apache2/sites-available/wordpress.conf looks like this:

    DocumentRoot /srv/www/wordpress
    <Directory /srv/www/wordpress>
        Options FollowSymLinks
        AllowOverride Limit Options FileInfo
        DirectoryIndex index.php
        Require all granted
    </Directory>
    <Directory /srv/www/wordpress/wp-content>
        Options FollowSymLinks
        Require all granted
    </Directory>
</VirtualHost>

Can I get some help please?

You may need check the apache virtual host configured in /etc/apache2/sites-available/file in any editor:

sudo vi /etc/apache2/sites-available/yourhost.lan.conf

if you are using an specific IP address and this changed, you will need refresh the new ip address in you hosts directory in order to renew the ip address to be used for http requests and then restart the apache service with the new ip address.

sudo vi /etc/hosts

If you want to reach the new ip address from the same pc, you will need check if his hosts file has the new ip address,

This ip address is the localhost Ip also known as the loopback address, using the loopback interface bypass any local network interface hardware. This local loopback is useful for testing software, if your locally running a web browser to http://localhost may display ist home page because is pointing at his localhost ip so for testing purpose you can keep it and you can add the new ip address down of this ip address Example

127.0.0.1 localhost 127.0.1.1
192.168.225.22   ostechnix1.lan

The next link can help you on how to configure your apache

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM