LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-23-2019, 06:24 PM   #1
m1rr0rm3
LQ Newbie
 
Registered: Jan 2013
Location: Planet Earth
Distribution: RHEL v7.6
Posts: 28

Rep: Reputation: Disabled
apache httpd.conf file help


I am having trouble with my httpd.conf file in RedHat 7.6. I cannot get port 80 or port 443 to recognize on start up. I can get port 8080 or port 8443 to recognize after the installation of a SSL from Digicert. If someone would be so kind as to help me through this process.

/etc/httpd/conf/httpd.conf
Listen :443

# Custom Virtual Hosts
<VirtualHost *:80>
ServerName domain.com
redirect permanent / https://www.domain.com/
</VirtualHost>

<VirtualHost *:443>
SSLEngine on
SSlCertificateFile /etc/pki/tls/certs/server.crt
SSLCertificateKeyFile /etc/pki/tls/private/domain.key
ServerAdmin hostmaster@domain.com
DocumentRoot /var/www/domain.com/public_html
ServerName domain.com
ServerAlias domain.com
ErrorLog logs/domain.com-error_log
CustomLog logs/domain.com-access_log common
</VirtualHost>


if I change my port to 8080 I can see this:
# lsof -i :443
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
httpd 9801 root 5u IPv6 801115306 0t0 TCP *:https (LISTEN)
httpd 10026 apache 5u IPv6 801115306 0t0 TCP *:https (LISTEN)
httpd 10028 apache 5u IPv6 801115306 0t0 TCP *:https (LISTEN)
httpd 10029 apache 5u IPv6 801115306 0t0 TCP *:https (LISTEN)
httpd 10030 apache 5u IPv6 801115306 0t0 TCP *:https (LISTEN)
httpd 10031 apache 5u IPv6 801115306 0t0 TCP *:https (LISTEN)

# lsof -i :21
# lsof -i :80
# lsof -i :22
# lsof -1 :20
# lsof -l :53 named running
# lsof -i :110

I found this post as a reference

https://www.linuxquestions.org/quest...-443-a-110753/

Any help would be great
 
Old 03-23-2019, 07:05 PM   #2
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
Try
Code:
netstat -tlnp
to see what processes are listening on which port.

Otherwise, it's not clear what you mean my "having trouble" Please further explain the issues.
 
Old 03-23-2019, 10:13 PM   #3
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by m1rr0rm3 View Post
I cannot get port 80 or port 443 to recognize on start up.
What to you mean by "recognize"?
Quote:
if I change my port to 8080 I can see this:
Code:
# lsof -i :443
COMMAND   PID   USER   FD   TYPE    DEVICE SIZE/OFF NODE NAME
httpd    9801   root    5u  IPv6 801115306      0t0  TCP *:https (LISTEN)
httpd   10026 apache    5u  IPv6 801115306      0t0  TCP *:https (LISTEN)
httpd   10028 apache    5u  IPv6 801115306      0t0  TCP *:https (LISTEN)
httpd   10029 apache    5u  IPv6 801115306      0t0  TCP *:https (LISTEN)
httpd   10030 apache    5u  IPv6 801115306      0t0  TCP *:https (LISTEN)
httpd   10031 apache    5u  IPv6 801115306      0t0  TCP *:https (LISTEN)
This doesn't make sense to me. You say that when you set the Listen port to 8080, apache listens on 443? Do you mean that before reconfiguring the Listen port to 8080, it did not listen on 443?

By the way, it seems to me that you need two Listen directives in httpd.conf, one for 80, one for 443.

My suggestion: Go back to the previous configuration (default ports 80 and 443), and describe precisely what is wrong. E.g. you perform a certain action and get error messages, or unexpected behaviour.

Last edited by berndbausch; 03-23-2019 at 10:19 PM.
 
Old 03-23-2019, 10:17 PM   #4
m1rr0rm3
LQ Newbie
 
Registered: Jan 2013
Location: Planet Earth
Distribution: RHEL v7.6
Posts: 28

Original Poster
Rep: Reputation: Disabled
Good evening. With the /etc/httpd/conf/httpd.conf set to Listen :8080 this is the result of netsat -tlnp
# netstat -tlnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 9976/smbd
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1/systemd
tcp 0 0 174.77.226.70:8080 0.0.0.0:* LISTEN 9801/httpd
tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 11161/dnsmasq
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 10838/named
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 9601/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 9604/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 12558/master
tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN 10838/named
tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 9976/smbd
tcp6 0 0 :::139 :::* LISTEN 9976/smbd
tcp6 0 0 :::111 :::* LISTEN 1/systemd
tcp6 0 0 ::1:53 :::* LISTEN 10838/named
tcp6 0 0 :::22 :::* LISTEN 9601/sshd
tcp6 0 0 ::1:631 :::* LISTEN 9604/cupsd
tcp6 0 0 ::1:25 :::* LISTEN 12558/master
tcp6 0 0 ::1:953 :::* LISTEN 10838/named
tcp6 0 0 :::443 :::* LISTEN 9801/httpd
tcp6 0 0 :::445 :::* LISTEN 9976/smbd

when I switch ports to port 80 this is what happens:
# systemctl start httpd.service
Enter SSL pass phrase for linuxrpms.com:443 (RSA) : **********
[root@linuxrpms conf]#

( firefox timeout )
# netstat -tlnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 9976/smbd
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1/systemd
tcp 0 0 174.77.226.70:80 0.0.0.0:* LISTEN 10235/httpd
tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 11161/dnsmasq
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 10838/named
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 9601/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 9604/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 12558/master
tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN 10838/named
tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 9976/smbd
tcp6 0 0 :::139 :::* LISTEN 9976/smbd
tcp6 0 0 :::111 :::* LISTEN 1/systemd
tcp6 0 0 ::1:53 :::* LISTEN 10838/named
tcp6 0 0 :::22 :::* LISTEN 9601/sshd
tcp6 0 0 ::1:631 :::* LISTEN 9604/cupsd
tcp6 0 0 ::1:25 :::* LISTEN 12558/master
tcp6 0 0 ::1:953 :::* LISTEN 10838/named
tcp6 0 0 :::443 :::* LISTEN 10235/httpd
tcp6 0 0 :::445 :::* LISTEN 9976/smbd

when I switch port to port 443 this is what happens:
systemctl start httpd.service
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.
Mar 23 23:12:40 linuxrpms.com httpd[21451]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:443
Mar 23 23:12:40 linuxrpms.com httpd[21451]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:443
Mar 23 23:12:40 linuxrpms.com httpd[21451]: no listening sockets available, shutting down
Mar 23 23:12:40 linuxrpms.com httpd[21451]: AH00015: Unable to open logs
Mar 23 23:12:40 linuxrpms.com systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Mar 23 23:12:40 linuxrpms.com kill[21456]: kill: cannot find process ""
Mar 23 23:12:40 linuxrpms.com systemd[1]: httpd.service: control process exited, code=exited status=1
Mar 23 23:12:40 linuxrpms.com systemd[1]: Failed to start The Apache HTTP Server.
Mar 23 23:12:40 linuxrpms.com systemd[1]: Unit httpd.service entered failed state.
Mar 23 23:12:40 linuxrpms.com systemd[1]: httpd.service failed.

digging deeper with journalctl -xe
# journalctl -xe
Mar 23 23:14:41 linuxrpms.com sshd[26802]: Failed password for root from 112.85.42.232 port 33011 ssh2
Mar 23 23:14:41 linuxrpms.com sshd[26805]: Failed password for root from 112.85.42.232 port 12561 ssh2
Mar 23 23:14:41 linuxrpms.com unix_chkpwd[26936]: password check failed for user (root)
Mar 23 23:14:41 linuxrpms.com sshd[26800]: pam_succeed_if(sshd:auth): requirement "uid >= 500" not met by user "root"
Mar 23 23:14:41 linuxrpms.com unix_chkpwd[26937]: password check failed for user (root)
Mar 23 23:14:41 linuxrpms.com sshd[26802]: pam_succeed_if(sshd:auth): requirement "uid >= 500" not met by user "root"
Mar 23 23:14:41 linuxrpms.com unix_chkpwd[26938]: password check failed for user (root)
Mar 23 23:14:41 linuxrpms.com sshd[26805]: pam_succeed_if(sshd:auth): requirement "uid >= 500" not met by user "root"
Mar 23 23:14:43 linuxrpms.com sshd[26800]: Failed password for root from 112.85.42.232 port 51075 ssh2
Mar 23 23:14:43 linuxrpms.com sshd[26802]: Failed password for root from 112.85.42.232 port 33011 ssh2
Mar 23 23:14:43 linuxrpms.com sshd[26805]: Failed password for root from 112.85.42.232 port 12561 ssh2
Mar 23 23:14:44 linuxrpms.com unix_chkpwd[27032]: password check failed for user (root)
Mar 23 23:14:44 linuxrpms.com sshd[26800]: pam_succeed_if(sshd:auth): requirement "uid >= 500" not met by user "root"
Mar 23 23:14:44 linuxrpms.com unix_chkpwd[27039]: password check failed for user (root)
Mar 23 23:14:44 linuxrpms.com sshd[26802]: pam_succeed_if(sshd:auth): requirement "uid >= 500" not met by user "root"
Mar 23 23:14:44 linuxrpms.com unix_chkpwd[27047]: password check failed for user (root)
Mar 23 23:14:44 linuxrpms.com sshd[26805]: pam_succeed_if(sshd:auth): requirement "uid >= 500" not met by user "root"
Mar 23 23:14:45 linuxrpms.com sshd[26800]: Failed password for root from 112.85.42.232 port 51075 ssh2
Mar 23 23:14:45 linuxrpms.com sshd[26802]: Failed password for root from 112.85.42.232 port 33011 ssh2
Mar 23 23:14:45 linuxrpms.com sshd[26805]: Failed password for root from 112.85.42.232 port 12561 ssh2
Mar 23 23:14:46 linuxrpms.com sshd[26800]: Received disconnect from 112.85.42.232 port 51075:11: [preauth]
Mar 23 23:14:46 linuxrpms.com sshd[26800]: Disconnected from 112.85.42.232 port 51075 [preauth]
Mar 23 23:14:46 linuxrpms.com sshd[26800]: PAM 2 more authentication failures; logname= uid=0 euid=0 tty=ssh ruser= rhost=112.85.42.232 u
Mar 23 23:14:46 linuxrpms.com sshd[26802]: Received disconnect from 112.85.42.232 port 33011:11: [preauth]
Mar 23 23:14:46 linuxrpms.com sshd[26802]: Disconnected from 112.85.42.232 port 33011 [preauth]
Mar 23 23:14:46 linuxrpms.com sshd[26802]: PAM 2 more authentication failures; logname= uid=0 euid=0 tty=ssh ruser= rhost=112.85.42.232 u
Mar 23 23:14:46 linuxrpms.com sshd[26805]: Received disconnect from 112.85.42.232 port 12561:11: [preauth]
Mar 23 23:14:46 linuxrpms.com sshd[26805]: Disconnected from 112.85.42.232 port 12561 [preauth]
Mar 23 23:14:46 linuxrpms.com sshd[26805]: PAM 2 more authentication failures; logname= uid=0 euid=0 tty=ssh ruser= rhost=112.85.42.232 u
Mar 23 23:14:48 linuxrpms.com unix_chkpwd[27245]: password check failed for user (root)
Mar 23 23:14:48 linuxrpms.com sshd[27159]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=182.106
Mar 23 23:14:48 linuxrpms.com sshd[27159]: pam_succeed_if(sshd:auth): requirement "uid >= 500" not met by user "root"
Mar 23 23:14:50 linuxrpms.com sshd[27159]: Failed password for root from 182.106.191.39 port 61117 ssh2
Mar 23 23:14:51 linuxrpms.com sshd[27159]: Received disconnect from 182.106.191.39 port 61117:11: Bye Bye [preauth]
Mar 23 23:14:51 linuxrpms.com sshd[27159]: Disconnected from 182.106.191.39 port 61117 [preauth]


this is my problem
 
Old 03-23-2019, 11:32 PM   #5
m1rr0rm3
LQ Newbie
 
Registered: Jan 2013
Location: Planet Earth
Distribution: RHEL v7.6
Posts: 28

Original Poster
Rep: Reputation: Disabled
https://httpd.apache.org/docs/2.4/bind.html

Overlapping Listen directives will result in a fatal error which will prevent the server from starting up.

(48)Address already in use: make_sock: could not bind to address [::]:80

See the discussion in the wiki for further troubleshooting tips.

https://wiki.apache.org/httpd/CouldNotBindToAddress
 
Old 03-24-2019, 02:01 AM   #6
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Request: It would really make the text more readable if you put it into code tags.

Hint: You can see all httpd log messages with journalctl -u httpd.

Guess: When you try to start a web server, another one is still running, causing the address in use error. Don’t use systemctl start, but systemctl restart or even reload. Or explicitly stop the server systemctl stop before starting it.

Last edited by berndbausch; 03-24-2019 at 02:11 AM.
 
Old 03-24-2019, 04:03 AM   #7
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:
Originally Posted by m1rr0rm3 View Post
https://httpd.apache.org/docs/2.4/bind.html

Overlapping Listen directives will result in a fatal error which will prevent the server from starting up.

(48)Address already in use: make_sock: could not bind to address [::]:80

See the discussion in the wiki for further troubleshooting tips.

https://wiki.apache.org/httpd/CouldNotBindToAddress
There are two "Listen 443" directives, so apache tries to open the same port a second time and it complains.

Please notice that there is the file /etc/httpd/conf.d/ssl.conf that is included by default in the main /etc/httpd/conf/httpd.conf, where you should configure everything regarding SSL.
In that file there is a "Listen 443" directive too.
So move the SSL configuration from the main /etc/httpd/conf/httpd.conf to /etc/httpd/conf.d/ssl.conf and you'll be ok.
 
1 members found this post helpful.
Old 03-24-2019, 09:41 AM   #8
m1rr0rm3
LQ Newbie
 
Registered: Jan 2013
Location: Planet Earth
Distribution: RHEL v7.6
Posts: 28

Original Poster
Rep: Reputation: Disabled
I did all of that. Can't figure out why Firefox times out.

- Chris
 
Old 03-24-2019, 11:04 AM   #9
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:
Originally Posted by m1rr0rm3 View Post
I did all of that. Can't figure out why Firefox times out.

- Chris
You should first check if apache is running and listening on the default ports:
Code:
netstat -tanpl|grep httpd
 
Old 03-24-2019, 11:22 AM   #10
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
In https://www.linuxquestions.org/quest...4/#post5977069, firefox times out because port 8080 is (probably) protected by the firewall, and Apache doesn’t listen on any other IPv4 port.

Last edited by berndbausch; 03-24-2019 at 11:23 AM.
 
Old 03-25-2019, 09:01 PM   #11
m1rr0rm3
LQ Newbie
 
Registered: Jan 2013
Location: Planet Earth
Distribution: RHEL v7.6
Posts: 28

Original Poster
Rep: Reputation: Disabled
I got it working on the following port

https://www.linuxrpms.com:8080

But the standard port of 443 does not want to seem to work

In the /etc/httpd/conf.d/ssl.conf file it is listed as

Listen 8080 https

If I change it to

Listen 443 https

Firefox times out
 
Old 03-26-2019, 03:11 AM   #12
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:
Originally Posted by m1rr0rm3 View Post
I got it working on the following port

https://www.linuxrpms.com:8080

But the standard port of 443 does not want to seem to work

In the /etc/httpd/conf.d/ssl.conf file it is listed as

Listen 8080 https

If I change it to

Listen 443 https

Firefox times out
As others have said above, maybe port 443 is closed by your ISP
 
Old 03-26-2019, 08:23 AM   #13
tyler2016
Member
 
Registered: Sep 2018
Distribution: Debian, CentOS, FreeBSD
Posts: 243

Rep: Reputation: Disabled
Try:

Code:
# iptables-save
# ip6tables-save
To view your firewall rules. It should be somewhat intuitive. Most of the command line switches should be somewhat intuitive based on their arguments. When a packet matches -j ACCEPT, -j REJECT or -j DROP processing will stop and the -j action will be performed.

Last edited by tyler2016; 03-26-2019 at 08:26 AM.
 
Old 03-26-2019, 09:20 AM   #14
dc.901
Senior Member
 
Registered: Aug 2018
Location: Atlanta, GA - USA
Distribution: CentOS/RHEL, openSuSE/SLES, Ubuntu
Posts: 1,005

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
Quote:
Originally Posted by m1rr0rm3 View Post
If I change it to

Listen 443 https

Firefox times out
Where is the Firefox browser; local machine or different?
After changing to port 443, stop/start httpd. Then look at "netstat -tanpl|grep httpd" output.
Also, try "telnet localhost 443"
If that connects, your httpd config is working.
 
Old 03-28-2019, 10:03 AM   #15
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
8080 and 8443 are tomcat ports (java)

for httpd have a look for/at/in /etc/httpd/conf/ports.conf or possibly /etc/httpd/ports.conf
 
  


Reply

Tags
apache, http, https, redhat, ssl



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
I overwrote /etc/httpd/conf/httpd.conf NotionCommotion Linux - Newbie 10 04-25-2014 11:58 AM
How to configure /etc/httpd/conf/httpd.conf file to run a html on web arunava.saha Red Hat 2 05-30-2012 03:28 AM
httpd: Syntax error on line 210 of /etc/httpd/conf/httpd.conf: Syntax error on line 6 iswarya Linux - Newbie 1 01-25-2012 01:28 PM
Starting httpd: httpd: Syntax error on line 209 of /etc/httpd/conf/httpd.conf: Syntax sethukpathi Linux - Networking 6 04-12-2008 11:26 AM
httpd chokes on ScriptAlias line in Apache httpd.conf lhoff Linux - Software 1 07-14-2003 10:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:55 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