How to load a site from Apache using VM's Static / Floating IP ?

I have site deployed and running on CentOS 8, Apache at

$ sudo netstat -tulpn | grep LISTEN

tcp6       0      0 :::81                   :::*                    LISTEN      32040/httpd.bin    

I can see the site response when using:

$ curl -v 
$ vi /etc/hosts

# The following lines are desirable for IPv4 capable hosts magento-centos8-1 magento-centos8-1 localhost.localdomain localhost localhost4.localdomain4 localhost4

When trying to or redirects me to

What am i missing?

Submit an answer

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!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

After some research, found the solution.

Change the Apache httpd.conf file usually at /etc/httpd/conf/http.conf file as below and restart Apache. You site should load from http://STATIC_IP

<VirtualHost *:81>
    ServerName STATIC_IP
    ServerAlias STATIC_IP
    DocumentRoot "/opt/magento-2.3.5-1/apps/magento/htdocs"

    Include "/opt/magento-2.3.5-1/apps/magento/conf/httpd-app.conf"

In the above example:

  1. I used Port 81 for Apache (usually it will be 80).
  2. DocumentRoot is where your website files are installed.