繁体   English   中英

为什么apache2中本地IP地址重路由?

[英]Why is the local IP address rerouting in apache2?

我按照本教程安装了 wordpress 站点:
https://ubuntu.com/tutorials/install-and-configure-wordpress#1-overview
效果很好。 我从来没有遇到过问题......直到我决定将虚拟服务器移动到新网络。 DHCP在新网络上建立了一个新的IP地址,其他设备可以ping通。
但是,当我在浏览器中输入新的 IP 地址时,它会重定向到旧的 IP 地址,大约 2 分钟后它说它无法访问。 即使我把它隐身并做了 DNS 刷新。 我试过修改我的 .htaccess 但这没有用。

我的 /etc/apache2/sites-available/wordpress.conf 看起来像这样:

    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>

请问我能得到一些帮助吗?

您可能需要在任何编辑器中检查 /etc/apache2/sites-available/file 中配置的 apache 虚拟主机:

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

如果你想从同一台电脑访问新的 ip 地址,你需要检查他的主机文件是否有新的 ip 地址,

这个 ip 地址是 localhost Ip 也称为环回地址,使用环回接口绕过任何本地网络接口硬件。 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下面这个 ip 地址示例

127.0.0.1 localhost 127.0.1.1
192.168.225.22   ostechnix1.lan

下一个链接可以帮助您了解如何配置您的 apache

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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