I have multiple web project in the same VPS as below:
/var/www/html/
│---webapp1/
│ │---public/
│ │ │---index.php
│---webapp2/
│ │---public/
│ │ │---index.php
│---index.html
I want to serve the webapp1
under 95.87.154.170:81
and webapp2
under 95.87.154.170:87
.
I have tried to create virtual hosts /etc/apache2/sites-available/webapp1.conf
:
<VirtualHost *:81>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/webapp1
<Directory /var/www/html/webapp1>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
and /etc/apache2/sites-available/webapp2.conf
:
<VirtualHost *:87>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/webapp2
<Directory /var/www/html/webapp2>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
But it doesn't work when I visit 95.87.154.170:81
or 95.87.154.170:87
it shows ERR_EMPTY_RESPONSE
. Both sites are enabled. My problem is I have only one IP and I don't have domain names. Is there any possibility to solve it in this way?