Apache webserver troubleshooting

Need assistance in getting apache installation troubleshooting..

  • Compiled source code of apache webserver , Installed and configured apache,
  • started apache web server with no errors.
  • web browser doesnt open any pages . say "Page cannot be displayed". Need troubleshooting .
  • When i type http://hostname:8080 it doesnt open
303 % /local/tools/apache/bin/httpd -v
Server version: Apache/2.4.9 (Unix)
Server built:   Jul 10 2014 17:21:12
 /local/tools/apache/bin/apachectl -S
VirtualHost configuration:
ServerRoot: "/local/tools/apache"
Main DocumentRoot: "/local/tools/apache/htdocs"
Main ErrorLog: "/local/tools/apache/logs/error_log"
Mutex default: dir="/local/tools/apache/logs/" mechanism=default
PidFile: "/local/tools/apache/logs/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="weather" id=37274 not_used
Group: name="weather" id=100504 not_used
300 % ps -ef |grep http
weather  22178     1  0 11:09 ?        00:00:00 /local/tools/apache/bin/httpd -k start
weather  22179 22178  0 11:09 ?        00:00:00 /local/tools/apache/bin/httpd -k start
weather  22180 22178  0 11:09 ?        00:00:00 /local/tools/apache/bin/httpd -k start
weather  22182 22178  0 11:09 ?        00:00:00 /local/tools/apache/bin/httpd -k start
302 % /local/tools/apache/bin/httpd -t -D DUMP_MODULES
Loaded Modules:
 core_module (static)
 so_module (static)
 http_module (static)
 mpm_event_module (static)
 authn_file_module (shared)
 authn_core_module (shared)
 authz_host_module (shared)
 authz_groupfile_module (shared)
 authz_user_module (shared)
 authz_core_module (shared)
 access_compat_module (shared)
 auth_basic_module (shared)
 reqtimeout_module (shared)
 filter_module (shared)
 mime_module (shared)
 log_config_module (shared)
 env_module (shared)
 headers_module (shared)
 setenvif_module (shared)
 version_module (shared)
 unixd_module (shared)
 status_module (shared)
 autoindex_module (shared)
 dir_module (shared)
 alias_module (shared)
                                               

Hi.

Just a couple of quick questions: Exactly which OS are you using? Is Apache listening on port 8080? Are you running a firewall? Is port 8080 open? Are you using SELinux? Are the correct contexts on the files in DocumentRoot set?

Scoot

I am running Redhat 6 , SElinux was enabled,apache is listening to port 8080 and it is open.

308 % netstat -na | grep 8080
tcp        0      0 149.186.251.174:8080        0.0.0.0:*                   LISTEN
311 %  grep DocumentRoot /local/tools/apache/conf/httpd.conf
# DocumentRoot: The directory out of which you will serve your
DocumentRoot "/local/tools/apache/htdocs"
    # access content that does not live under the DocumentRoot.
312 % ls -l /local/tools/apache/htdocs/
total 4
-rw-r--r--. 1 weather weather 53 Jul 16 11:41 sample.html

Error log

[Mon Jul 21 10:36:10.723280 2014] [mpm_event:notice] [pid 34035:tid 140161124194048] AH00491: caught SIGTERM, shutting down
[Mon Jul 21 10:36:25.073844 2014] [mpm_event:notice] [pid 81038:tid 139893008946944] AH00489: Apache/2.4.9 (Unix) configured -- resuming normal operations
[Mon Jul 21 10:36:25.074062 2014] [core:notice] [pid 81038:tid 139893008946944] AH00094: Command line: '/local/tools/apache/bin/httpd -f /local/tools/apache/
conf/httpd.conf'
[Mon Jul 21 10:40:06.924680 2014] [mpm_event:notice] [pid 81038:tid 139893008946944] AH00491: caught SIGTERM, shutting down
[Mon Jul 21 11:09:33.172809 2014] [mpm_event:notice] [pid 22178:tid 139888978118400] AH00489: Apache/2.4.9 (Unix) configured -- resuming normal operations
[Mon Jul 21 11:09:33.173060 2014] [core:notice] [pid 22178:tid 139888978118400] AH00094: Command line: '/local/tools/apache/bin/httpd'

---------- Post updated 07-22-14 at 10:15 AM ---------- Previous update was 07-21-14 at 12:38 PM ----------

Looks like nobody knows anything about apache !!!!

If you don't get an answer immediately, wait! We are not "on call".

Why have you compiled apache from source? Certainly Redhat must have a package available for it! Compiling from source by hand may cause uncommon problems which we couldn't predict, depending on what configuration you chose.

Having SElinux enabled greatly complicates things. This problem may have nothing to do with your web server.

Do you see anything in /var/log/apache2/access_log ?

Did you forget to replace User and Group in httpd.conf ?

if so try this

$ apache_user="user"; apache_group="yourgroup"
$ sed -i 's/User daemon/User '"$apache_user"'/g;s/Group daemon/Group '"$apache_group"'/g' httpd.conf

I have added user/group

only one entry for access log.

/local/tools/apache/logs > more access_log
149.186.251.174 - - [10/Jul/2014:22:14:24 +0000] "GET /" 200 161

I used this to build on Centos as well as on ubuntu, you may try

./configure --prefix=path/to/http_version \
		    --with-ssl=path/to/ssl_version \
		    --with-z=path/to/zlib_version \
                    --with-apr=path/to/apr_version \
                    --with-apr-util=path/to/apr_utility_version \
                    --with-pcre=path/to/pcre_version  --enable-so
$ httpd  -v
Server version: Apache/2.4.7 (Unix)

Corona688: I have no other option than compiling as i dont have root access and engaging administrator is another hassel .

SElinux is probably just doing its job, preventing users from running their own local daemons without the administrator's knowledge and approval.

Akshay Hegde : Compiling is not an issue . I see all the http processes ,starting the webserver is also not an issue . But the page is not getting displayed. any inputs ?

---------- Post updated at 10:58 AM ---------- Previous update was at 10:57 AM ----------

Corona688 . But process are running .

/local/tools/apache/logs > ps -ef |grep http
weather  22178     1  0 Jul21 ?        00:00:03 /local/tools/apache/bin/httpd -k start
weather  22179 22178  0 Jul21 ?        00:00:23 /local/tools/apache/bin/httpd -k start
weather  22180 22178  0 Jul21 ?        00:00:23 /local/tools/apache/bin/httpd -k start
weather  22182 22178  0 Jul21 ?        00:00:23 /local/tools/apache/bin/httpd -k start

So what? That doesn't mean it's going to work.

I suspect this is SElinux doing its job, preventing users from running network daemons without the administrator's knowledge and approval. This is usually a useful function... An attacker can't just just dump in an IRC server or whatever to coordinate a botnet, even if they did manage to get in.

So you will likely need to ask your administrator to enable networking on that port for the daemon you installed without his knowledge.

Or, more likely, just get him to install an apache server properly.

I asked the administrator to open ports for 8080 which I am using a non root user port . So is that still a problem on SELinux

/local/tools/apache/logs > netstat -na|grep 8080
tcp        0      0 149.186.251.174:8080        0.0.0.0:*                   LISTEN

---------- Post updated at 11:10 AM ---------- Previous update was at 11:08 AM ----------

Only problem when having root user to install webserver is everytime you want to update httpd.conf you need root user to update . Which is not feasible . So its always good to compile your own source code and edit the configuration as possible .

Things which don't require explicit permission in ordinary Linux, do in SElinux -- that is the entire point of having it. SElinux is "security-enhanced Linux". It adds many extra layers of checks and controls. Often we get people coming here having problems with ordinary programs in SElinux, the solution of which is to enable certain special SElinux options, permissions, or bug their administrator to do so. It's a completely different kettle of fish.

So it's entirely possible that you're not getting the access you need just because SElinux isn't configured to allow full access to rogue daemons which someone just happened to upload without Administrator oversight or approval.

Most distributions of apache organize it into sub-files, so you don't need to edit httpd.conf at all. File access permissions or a line in sudoers or whatever could easily be set up so you could edit any of those files yourself anyway.