Apache Lounge


About Forum Index Downloads Search Register Log in  RSS Apache Lounge  

Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.



A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.

Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Help With Virtual Hosts

Joined: 14 Nov 2018
Posts: 1
Location: USA,Golden

PostPosted: Thu 15 Nov '18 0:30    Post subject: Help With Virtual Hosts Reply with quote


First, I want to say that I am a Noob at all of this and have no experience with Linux, Apache, php, or WordPress. That being said, I have spent the last 7 to 10 days trying to learn something about them.

My overall idea is to create a website in WordPress that will serve up the same content for four different domains in http and https. The domains are the .com, .net, .info, and .org versions of the same site. Example.org would be the main site. What I have done so far is build an Intel server with two NIC cards. One NIC for our local network with a private IP like the second NIC is for the Public IP address for use in the DNS. I then set up each domains DNS to point to the single Public IP. Next, I installed and configured CentOS 7.5.1804, installed the LAMP stack including Apache 2.4.6 and php 2.4.0. Installed WordPress and created some content to test with. At this point everything is pretty much working as planned. Going to either of these sites in a browser currently brings up the desired content externally on the Public IP and internally on the local private address. Now the issue at hand is to get it to work with https.

I decided to use Let’s Encrypt for my certificates. I installed the EPEL repository and then installed mod-ssl python-certbot-apache, restarted httpd, checked to see if the service was “active” and checked to make sure ports 80 and 443 were open on the firewall. I then used curl and curl -k to ensure that the example.org site was reachable. Both returned me back to the command prompt after a few seconds of execution with no errors. Next, I ran certbot –apache without any domains. I was prompted for the domains. Upon Entering the domains and continuing I got the message: “Unable to find a virtual host listening on port 80 which is currently needed for Certbot to prove to the CA that you control your domain. Please add a virtual host for port 80.” I know that I should create a virtual host for each domain but I’m not exactly sure how.

I could probably create directories for each domain with a public_html subdirectory under each but it seems that would require duplicating the website code to each of the subdirectories. Can four domains share the same DocumentRoot directory? If someone could please give me an example of what my virtual host entries should look like for the domains example.com, example.net, example.org, example.info, I would greatly appreciate it. I probably only need to see how two of the virtual host entries look to determine what is duplicate and non-duplicate info.

Also, how would I determine exactly where WordPress is storing the needed info for DocumentRoot? Thanks very much, ahead of time, for your help.

Please be nice. Ten days ago I couldn’t even spell Linux, I’ve come this far, but I’m truly lost now.
Back to top

Joined: 15 Nov 2018
Posts: 4
Location: USA, Radcliff

PostPosted: Thu 15 Nov '18 10:10    Post subject: Reply with quote

Eagerly waiting on an SME to share their potential solutions to your situation. My situation is quite similar and I'm looking for some good feedback.

Good luck with your project.

Back to top
James Blond

Joined: 19 Jan 2006
Posts: 6701
Location: Germany, Next to Hamburg

PostPosted: Wed 21 Nov '18 18:43    Post subject: Reply with quote

Yes you can share the same document root for each vhost if you use wordpress. Wordpress supports multiple domains / websites with one code bvase and a single database. Google for wordpress multisite and you will find some examples hiow to do it.

If you still have a question please ask again.
Back to top

Reply to topic   Topic: Help With Virtual Hosts View previous topic :: View next topic
Post new topic   Forum Index -> Apache