Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Should I have two different httpd.conf files for virtual hosting?

Shirley Shorter August 9, 2018

I have root access and am preparing to set up reverse proxy behind Apache/CentOs for JIRA install. My PostgreSQL works fine after much hair pulling and SSL is all set up. I will have to configure virtual host entries using Include files and CPANEL/WHM .

I plan to use CPANEL to set up jira.myserver.com and atlassian.myserver.com to point to the directories myserver.com:8080/jira and myserver.com:8090/confluence  

Do I really need to set up reverse proxy when working through CPANEL this way?  

   I noticed I have two different httpd.conf files. One is in /usr/local/apache/conf and contains info from an older myOldServername1 and ns1.old and ns2.old nameservers (used before I had dedicated hosting). There is another httpd.conf in /etc/apache2/conf which contains my current myNewServername2 and ns1.new and ns2.new.   What the? 

I ran a dns check against my website  and no errors found). (also, can I use the same listen port for both http and https for JIRA? Currently there is a redirect for http to go to https). 

I asked the ISP about having different httpd.conf files and they say if it's not broke don't fix it. I am concerned about how my virtual hosts will work and if anything is pointing to the old myServername1 returning 404s or something. What do you think?  Is having two separate httpd.confs a problem? 

Whew, that is a mouthful. Just so you know, I am really new to all this LINUX stuff. Thanks!!! 

1 answer

1 accepted

3 votes
Answer accepted
Hernan Montes
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 9, 2018

Hello Shirley,

From experience I can say that having 2 main configuration files will make management difficult, if you are using virtualhosts on both and for some reason the ports overlap, you will end up doing more troubleshoot than needed, it is always better to have one main configuration files and include your virtual host .conf files, when including (eg. include conf.d/*.conf) you can easily look for any configurations and / or virtual hosts, so in short, use just 1 httpd.conf file and include the rest of your configuration in external .conf files (ssl.conf, proxy.conf, etc.).

Not sure why your ISP will tell you "if it's not broke don't fix it" instead of looking for a better solution.

In any normal scenario, you will redirect port 80 to 443 when using SSL, but answering your question, you cannot use same ports for JIRA, if you want to reach jira on both 80 and 443 (http / https) configure an extra connector in the server.xml and then use reverseproxy to point the webserver to those ports.

<Connector port=8080
 maxThreads=<default>
    minSpareThreads=<default>
    connectionTimeout=<default>
    enableLookups=<default>
    maxHttpHeaderSize=<default>
    protocol=<default>
    useBodyEncodingForURI=<default>
    redirectPort=<default>
    acceptCount=<default>
    disableUploadTimeout=<default>
 proxyName="<subdomain>.<domain>.com"
 proxyPort="80"
 scheme="http"/>
<Connector port=8081
 maxThreads=<default>
    minSpareThreads=<default>
    connectionTimeout=<default>
    enableLookups=<default>
    maxHttpHeaderSize=<default>
    protocol=<default>
    useBodyEncodingForURI=<default>
    redirectPort=<default>
    acceptCount=<default>
    disableUploadTimeout=<default>
 proxyName="<subdomain>.<domain>.com"
 proxyPort="443"
 scheme="https"/>

then in your .conf you will reverseproxy those

ProxyPass / http://<internal_domain>:8080
    ProxyPassReverse / http://<internal_domain>:8080
ProxyPass / http://<internal_domain>:8081
    ProxyPassReverse / http://<internal_domain>:8081

 Hope this helps!

Suggest an answer

Log in or Sign up to answer