I am trying to open a port on the droplet, to add a second site which I want to access via ip:port (in my case port 8000). I have this config files:
main.conf
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/VetPartnersPrintPortal/public
<Directory /var/www/html/VetPartnersPrintPortal/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<IfModule mod_dir.c>
DirectoryIndex index.php index.pl index.cgi index.html index.xhtml index.htm
</IfModule>
</VirtualHost>
<VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html/VetPartnersPrintPortal/public
<Directory /var/www/html/VetPartnersPrintPortal/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<IfModule mod_dir.c>
DirectoryIndex index.php index.pl index.cgi index.html index.xhtml index.htm
</IfModule>
</VirtualHost>
slider.conf
<VirtualHost *:8000>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/slider/
<Directory /var/www/html/slider/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<IfModule mod_dir.c>
DirectoryIndex index.php index.pl index.cgi index.html index.xhtml index.htm
</IfModule>
</VirtualHost>
ufw status give following:
Status: active
To Action From
-- ------ ----
22/tcp LIMIT Anywhere
443/tcp ALLOW Anywhere
80/tcp ALLOW Anywhere
22 ALLOW Anywhere
8000 ALLOW Anywhere
8000/tcp ALLOW Anywhere
22/tcp (v6) LIMIT Anywhere (v6)
443/tcp (v6) ALLOW Anywhere (v6)
80/tcp (v6) ALLOW Anywhere (v6)
22 (v6) ALLOW Anywhere (v6)
8000 (v6) ALLOW Anywhere (v6)
8000/tcp (v6) ALLOW Anywhere (v6)
What am I doing wrong here? The main site can be accessed, but slider is giving an error:
Unable to connect
Firefox can’t establish a connection to the server at
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!
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.
Hello,
I think that you would need to add port
8000
as aListen
port as well so that Apache listens on that port before you could use it in your Vhost.To do that open this file:
And bellow the
Listen 80
line addListen 8000
and then restart Apache:To check if Apache is listening on the port run:
Then the Vhost setup that you have should work as expected.
Hope that this helps. Regards, Bobby