LAMP environment domain name and IP address both display the same webpage, how to set it?


 This is because the domain name is not bound to the IP of your VPS public network.

Modify the configuration file /usr/local/apache/conf/extra/httpd-vhosts.conf

Beginning on line 1 of this file, append the following virtual host configuration:

<virtualhost *:80>
ServerName public IP address
Redirect 301 / full URL (eg: https://teddysun.com)
</virtualhost>
Note that the format is 301+space+slash+space+full URL.
Then save and restart Apache.

Post a Comment

Previous Post Next Post