-1

I have Apache running on a debian server. On the initial install and setup, it was running fine on port 80, I successfully installed an instance of Wordpress and everything was fine.

I want to reduce hammering from portscanning so I am not using port 80.

I added ports 4041 and 4045 to the ports.conf and that's when the problems appeared.

The ports.conf:

Listen 4041
Listen 4045

<IfModule ssl_module>
        Listen 443
</IfModule>

<IfModule mod_gnutls.c>
        Listen 443
</IfModule>

The file sites-enabled/000-default.conf:

<VirtualHost *:4041>
        ServerAdmin webmaster@localhost
        ServerName zeus
        DocumentRoot /var/www/html
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

<VirtualHost *:4045>
        ServerAdmin webmaster@localhost
        ServerName zeus
        DocumentRoot /var/www/html/wordpress
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

These are the only files that I have altered, as I have another machine acting as a web server just fine.

What I get is any attempt to access http://<ip>:4041 retrieves the default "Successfully installed Apache" index.html and the URL reads http://<ip> leaving off the port direction, which is different than what I see on my working server. port 4041 root

Then there is the problem that accessing /wordpress fails.

port 4041, transition port 4041 fails

If I access http://<ip>:4045 I am expecting to see my Wordpress home page, based on the assigned DocumentRoot but all I get is fail: port 4045 "unsafe port"?

If I change everything back to port 80, it all works fine.

enter image description here

Is there a compile instance functionality that I am missing?

I am baffled.

This is the most difficulty I have ever had with Apache and I have been doing the most basic things with it for more than 15 years.

I have been fussing with this for 6 hours now. GAH!!

EDIT: 2016 12 21 Port 4045 is in the list of UNSAFE ports for Chrome:

Ken Ingram
  • 101
  • 4

2 Answers2

0

What I get is any attempt to access http://:4041 retrieves the default "Successfully

This is expected as the virtual host on port 4041 is configured to server content from the directory

/var/www/html

but to my understanding your wordpress installation is located on

/var/www/html/wordpress

Then there is the problem that accessing /wordpress fails

This is also expected. When you access

http://192.168.1.20:4045/wordpress

the wordpress site is served as expected but what happens is that the wordpress code redirects you to

http://192.168.1.20/wordpress

because wordpress stores the installation URL in its database.

To fix this issue you have to fix wordpress URL's using one the way describes in the following URL:

https://codex.wordpress.org/Changing_The_Site_URL

Vikelidis Kostas
  • 927
  • 1
  • 6
  • 15
-1

I guess your config is not complete/correct. The following answer Declaring multiple ports for the same VirtualHosts seems to cover your use case