0

I have two wordpress sites in different root folders on the same apache server. I need to use of different ports for each so that when I enter

<my public ipaddress>:8081  

in a browser it will forward me to "/var/www/html/fwtest1.com" and pickup index.php from there.

So far I made changes in httpd.conf thus...

Listen 8081  
Listen 8082  #Listen 80 removed  

NameVirtualHost *:8081  
NameVirtualHost *:8082  

<VirtualHost *:8081>  
    DocumentRoot /var/www/html/fwtest1.com  
</VirtualHost>  

<VirtualHost *:8082>  
   DocumentRoot /var/www/html/fwtest2.com  
</VirtualHost>  

Then in my browser I type "ipaddress:8081" (or 8082 respectively and where ipaddress = my public IP). But I only get Http Error 500. I have also tried putting defines in my wordpress wp-config.php such as below, but to no avail.

define('WPSITEURL','<my public ipaddress>:8081/fwtest1.com'  
define('WPHOME','<my public ipaddress>:8081:/fwtest1.com'  

I'm not presently using DNS but plan to as soon as I get this working. Can anyone please help me understand what I'm doing wrong? ~B.Ed

B.Ed
  • 1
  • 1
  • Is this a programming question? – Jonathon Reinhart May 01 '17 at 02:09
  • No really. My question is referencing the Apache configuration file. doesn't seem to work for in this case. I've also tried two DNS names in the same manner with no luck. I know I can use through port 80, refence the serverName and DocumentRoot successfully. But I will need to know how and understand the port routing there for more important reasons. – B.Ed May 02 '17 at 13:15
  • your problem has nothing to do with all the data you've shown in the question, an error 500 is probably due to misconfiguration on the php scripts side. The configuration bits you've shown are perfectly correct and would never cause an error 500. Try making php be more verbose to find out what's going on. – Daniel Ferradal May 04 '17 at 07:48
  • thank you ezra-s. You are absolutely right. I found the answer yesterday and will post more about it shortly. – B.Ed May 05 '17 at 14:09

1 Answers1

0

I found the answer to be exactly as ezra s said.

First, I disabled wordpress and populated my subfolders with different index.htmls - one noting "fwtest1.com is working" and the other respectively to fwtest2.com. The changes worked perfectly.

So to get wordpress to work with the changes, I re-enabled wordpress and changed wp-admin/includes/network.php in both subfolders. By doing a search in the editor for "You cannot install a network of sites" in that file, the conditional statement for that line checks for port 80 and 443. I added the extra ports, 8081 & 8082 to that condition and saved the file.

changed...
if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' )
to...
if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443', ':8081', ':8082' )

It worked like magic for me.

B.Ed
  • 1
  • 1