httpd issue, connection time out

Issues related to configuring your network
Post Reply
mahmood
Posts: 65
Joined: 2017/06/04 12:21:09

httpd issue, connection time out

Post by mahmood » 2018/09/01 15:21:32

I have only changed the DocumentRoot after installing httpd, and put some files in the folder. Things are OK but when I enter the IP address of the machine in the browser from a remote location, I get connection timed out error.

The content of httpd.conf is

Code: Select all

[snadmin@localhost httpd]$ cat conf/httpd.conf
ServerRoot "/etc/httpd"
Listen 80
Include conf.modules.d/*.conf
User apache
Group apache
ServerAdmin root@localhost
<Directory />
    AllowOverride none
    Require all denied
</Directory>
DocumentRoot "/var/www/html"
<Directory "/var/www">
    AllowOverride None
    # Allow open access:
    Require all granted
</Directory>
<Directory "/var/www/html">
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>
<Files ".ht*">
    Require all denied
</Files>
ErrorLog "logs/error_log"
LogLevel warn
<IfModule log_config_module>
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common
    <IfModule logio_module>
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>
    CustomLog "logs/access_log" combined
</IfModule>
<IfModule alias_module>
    ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
</IfModule>
<Directory "/var/www/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
</Directory>
<IfModule mime_module>
    TypesConfig /etc/mime.types
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
</IfModule>
AddDefaultCharset UTF-8
<IfModule mime_magic_module>
    MIMEMagicFile conf/magic
</IfModule>
EnableSendfile on
IncludeOptional conf.d/*.conf

netstat shows 80 and 443 are fine

Code: Select all

[root@localhost httpd]# netstat -tulpn | grep httpd
tcp6       0      0 :::443                  :::*                    LISTEN      19077/httpd
tcp6       0      0 :::80                   :::*                    LISTEN      19077/httpd
Files exist

Code: Select all

[root@localhost httpd]# ls -l /var/www/html/
total 8
drwxr-xr-x. 3 root root   96 Aug 29 18:46 css
drwxr-xr-x. 2 root root   48 Aug 29 18:46 images
-rw-r--r--. 1 root root 4897 Aug 29 18:46 index.html
Service is running

Code: Select all

[root@localhost httpd]# systemctl status httpd.service
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
   Active: active (running) since Wed 2018-08-29 18:47:18 +0430; 3 days ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 19071 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS)
 Main PID: 19077 (httpd)
   Status: "Total requests: 0; Current requests/sec: 0; Current traffic:   0 B/sec"
    Tasks: 6
   CGroup: /system.slice/httpd.service
           ├─19077 /usr/sbin/httpd -DFOREGROUND
           ├─19078 /usr/sbin/httpd -DFOREGROUND
           ├─19079 /usr/sbin/httpd -DFOREGROUND
           ├─19080 /usr/sbin/httpd -DFOREGROUND
           ├─19081 /usr/sbin/httpd -DFOREGROUND
           └─19082 /usr/sbin/httpd -DFOREGROUND

Aug 29 18:47:18 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
Aug 29 18:47:18 localhost.localdomain httpd[19077]: AH00558: httpd: Could not reliably determine the...age
Aug 29 18:47:18 localhost.localdomain systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
After restarting the service, I ran tail -f /var/log/httpd/error_log and at the same time, I entered http://w.x.y.z in the browser of my laptop. Nothing is written in the error log.

Any thought?

tunk
Posts: 405
Joined: 2017/02/22 15:08:17

Re: httpd issue, connection time out

Post by tunk » 2018/09/01 15:55:23

Have you opened the ports in the firewall?

mahmood
Posts: 65
Joined: 2017/06/04 12:21:09

Re: httpd issue, connection time out

Post by mahmood » 2018/09/01 17:10:52

Thank you very much. Some tutorials (which I read) didn't mention that. I know can see the test page.

Just want to know why httpd service is not listed in the service list.

Code: Select all

[root@localhost httpd]# firewall-cmd --permanent --add-port=80/tcp
success
[root@localhost httpd]# firewall-cmd --permanent --add-port=443/tcp
success
[root@localhost httpd]# firewall-cmd --reload
success
[root@localhost httpd]# firewall-cmd --zone=public --list-services
ssh dhcpv6-client
[root@localhost httpd]#

MartinR
Posts: 340
Joined: 2015/05/11 07:53:27
Location: UK

Re: httpd issue, connection time out

Post by MartinR » 2018/09/01 22:21:38

Because you didn't add a service, you added two ports. Try

Code: Select all

# firewall-cmd --zone=public --list-ports

Post Reply