LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-29-2016, 05:08 PM   #16
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032

Quote:
Disabled all other configs, enabled test.conf. For some reason going to either website address results in a directory listing of /var/www. Seems the vhost config isn't being loaded? so defaults to the config in apache2.conf?
I'm not very familiar with Ubuntu apache vhost config, but from what I've read, you should put the vhost config file in /etc/apache2/sites-available/test.conf and then run:
Code:
sudo a2ensite test
Run the following command to see if the vhosts defined in /etc/apache2/sites-available/test.conf are enabled
Code:
apache2ctl -S
 
Old 09-29-2016, 05:43 PM   #17
Planky
Member
 
Registered: Aug 2003
Posts: 35

Original Poster
Rep: Reputation: 0
Yes, conf lives in /etc/apache2/sites-available (where my original configs are as well, which still work when enabled).

Enabled using 'sudo a2ensite test'.
Confirmed presence in /etc/apache2/sites-enabled
Ran 'sudo service apache2 reload' to apply

Just cloning the host so I can test without interrupting the sites. I'll apache2ctl once I've got it up and running.
 
Old 09-29-2016, 06:11 PM   #18
Planky
Member
 
Registered: Aug 2003
Posts: 35

Original Poster
Rep: Reputation: 0
Commands run

Code:
> sudo a2dissite website1.com.conf
Site website1.com disabled.
To activate the new configuration, you need to run:
  service apache2 reload
> sudo a2dissite website2.com.conf
Site website2.com disabled.
To activate the new configuration, you need to run:
  service apache2 reload
> sudo a2ensite test.conf
Enabling site test.
To activate the new configuration, you need to run:
  service apache2 reload
> service apache2 reload
 * Reloading web server apache2
 *
Content of /etc/apache2/sites-enabled/test.conf

Code:
<VirtualHost *:443>
 ServerName www.website1.com
 DocumentRoot /var/www/website1.com

 SSLEngine on
    SSLCertificateFile /etc/apache2/ssl/website1.com.crt
    SSLCertificateKeyFile /etc/apache2/ssl/website1.com.key
    SSLCertificateChainFile /etc/apache2/ssl/website1.com.ca-bundle
</VirtualHost>

<VirtualHost *:443>
 ServerName www.website2.com
 DocumentRoot /var/www/website2.com
 SSLEngine on
 SSLCertificateFile /etc/apache2/ssl/www_website2_com.crt
 SSLCertificateKeyFile /etc/apache2/ssl/www_website2_com.key
 SSLCertificateChainFile /etc/apache2/ssl/www_website2_com.ca-bundle
</VirtualHost>
Results of apache2ctl -S
Code:
VirtualHost configuration:
*:443                  is a NameVirtualHost
         default server www.website1.com (/etc/apache2/sites-enabled/test.conf:1)
         port 443 namevhost www.website1.com(/etc/apache2/sites-enabled/test.conf:1)
         port 443 namevhost www.website2.com (/etc/apache2/sites-enabled/test.conf:11)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex default: dir="/var/lock/apache2" mechanism=fcntl 
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
Mutex rewrite-map: using_defaults
Mutex ssl-stapling: using_defaults
Mutex ssl-cache: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
Define: ENABLE_USR_LIB_CGI_BIN
User: name="www-data" id=33
Group: name="www-data" id=33
Result is a directory listing of /var/www when using either URL

Last edited by Planky; 09-29-2016 at 06:17 PM.
 
Old 09-29-2016, 09:20 PM   #19
Planky
Member
 
Registered: Aug 2003
Posts: 35

Original Poster
Rep: Reputation: 0
Just realised why it its showing the dir listing - bit of idiocy on my part.

The test conf only has SSL sites configured, whereas I was going to the non-ssl address. As nothing was specified, it used the apache2.conf which states the doc root was /var/www and has indexes turned on. Bleh.
 
Old 10-03-2016, 11:10 AM   #20
SAbhi
Member
 
Registered: Aug 2009
Location: Bangaluru, India
Distribution: CentOS 6.5, SuSE SLED/ SLES 10.2 SP2 /11.2, Fedora 11/16
Posts: 665

Rep: Reputation: Disabled
Please mark the thread solve if it is already.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
unbound with ssl redirects - doesn't resolve qwertyjjj Linux - Server 1 08-02-2014 01:20 AM
Redirects to SSL connections jrdioko Linux - Security 2 12-21-2005 08:53 PM
apache & ssl packages wwnexc Slackware 4 11-07-2005 11:01 AM
Apache & SSL Kronux Linux - Networking 2 08-24-2005 08:44 AM
Apache & SSL Torm3nt Linux - Newbie 1 01-07-2003 08:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration