LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-13-2018, 09:00 PM   #1
swanny99
LQ Newbie
 
Registered: May 2012
Distribution: CentOS
Posts: 26

Rep: Reputation: Disabled
Virtual host configuration for setting up SSL website - centos


Been trying for the first time to change a site to ssl. Got a free (for a while) certificate from comodo.

iptables listening on 443

certificate files installed

installed mod_ssl

I added to apache virtual host configuration file the following:-

NameVirtualHost ipnumbers:443
<VirtualHost ipnumbers:443>
SSLEngine on
SSLCertificateKeyFile /path-to-certs/servkey.key
SSLCertificateFile /path-to-certs/thecert.crt
SSLCertificateChainFile /path-to-certs/thecert.ca-bundle
ServerAdmin contact@domain.com
ServerName domain.com
ServerAlias www.domain.com
DocumentRoot /path-to-root
ScriptAlias cgi-path
CustomLog /path-to-log
</VirtualHost>

The rest of the domains in the configuration file have:-
<VirtualHost ipnumbers:80>
ServerAdmin contact@domain.com
ServerName domain.com
ServerAlias www.domain.com
DocumentRoot /path-to-root
ScriptAlias cgi-path
CustomLog /path-to-log
</VirtualHost>

But when I save the file and then try to restart apache, I get a warning that httpd is not running, (98) Address already in use: make_sock: could not bind to address...
At that point if I list running httpd, there are about 10.
In my browser at that point all sites on the server are 404.

I've tried lots of ways, but nothing I do works. I have since removed the new domain entry from the virtual host file, killall httpd, stop and start httpd and apache restart to get the websites back on again.
 
Old 03-13-2018, 09:20 PM   #2
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.5
Posts: 1,616

Rep: Reputation: 531Reputation: 531Reputation: 531Reputation: 531Reputation: 531Reputation: 531
By "apache virtual host configuration file" do you mean /etc/httpd/conf/httpd.conf ?

Out of the box, apache ssl is configured in /etc/httpd/conf.d/ssl.conf...so that's why the port is already in use.

Add your virtual configuration in the ssl.conf file (remove from httpd.conf) and restart. Let us know what happens.
 
Old 03-14-2018, 06:37 PM   #3
swanny99
LQ Newbie
 
Registered: May 2012
Distribution: CentOS
Posts: 26

Original Poster
Rep: Reputation: Disabled
Hello, thanks for the reply.

"By "apache virtual host configuration file" do you mean /etc/httpd/conf/httpd.conf ? " Yes I do.

"/etc/httpd/conf.d/ssl.conf" This file didn't exist, so I created it and added in the virtual configuration. But when I restarted apache it didn't like these lines:-
SSLEngine on
SSLCertificateKeyFile /path-to-certs/servkey.key
SSLCertificateFile /path-to-certs/thecert.crt
SSLCertificateChainFile /path-to-certs/thecert.ca-bundle

"Failure to start : line 3 command SSLEngine not recognized."

I reinstalled mod_ssl and then there was a file sl.conf.rpmnew in /conf.d/. In there it is like one long virtual host configuration with lots of comments. including SSLEngine on and the others above.
 
Old 03-14-2018, 06:45 PM   #4
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,230

Rep: Reputation: 711Reputation: 711Reputation: 711Reputation: 711Reputation: 711Reputation: 711Reputation: 711
You need a line (uncommented) like: "LoadModule ssl_module .../mod_ssl.so" in httpd.conf
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
SSL on Apache2 host with multiple Virtual Hosts... alavarre Linux - Server 2 12-28-2015 05:46 AM
Setting a SSL on a new virtual host eliassal Linux - Server 1 10-22-2010 05:38 AM
Apache 2.2.14 ignores SSL Cipher in Virtual Host Jukas Linux - Server 5 03-02-2010 04:44 PM
Apache disable SSL on a virtual host cashton2k Linux - Server 2 01-22-2010 04:17 AM
Apache with wildcard SSL and virtual host crispytwo Linux - Server 2 04-28-2009 08:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:38 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration