LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 03-12-2012, 04:09 PM   #1
dazdaz
Member
 
Registered: Aug 2003
Location: Europe
Distribution: RHEL, CentOS, Ubuntu
Posts: 333

Rep: Reputation: 17
Re-installing httpd on CentOS 6.2


Hi

I messed up the config on my CentOS 6.2 box and want to reinstall the httpd.conf from scratch.

According to this below, the config file nor the webserver itself is not owned by an RPM package.

Code:
# rpm -qf /etc/httpd/conf/httpd.conf
file /etc/httpd/conf/httpd.conf is not owned by any package

rpm -qf `which httpd`
file /usr/sbin/httpd is not owned by any package
Did I do something wrong, I don't understand why httpd is not packaged.

How can I get the original configuration file back ?

Thanks
 
Old 03-12-2012, 04:16 PM   #2
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
@ Reply

Hi dazdaz,

From the output that you have pasted it does not appear that you have got httpd installed. What is the output of:

Code:
rpm -qa | grep httpd
If it does not show anything then you have to install httpd. Appears like it has been removed. You can install httpd using the following command:

Code:
yum install httpd
Before you install httpd I would suggest that you make a copy of existing /var/www directory and /etc/httpd directory. It is better to be safe then sorry :-)
 
Old 03-12-2012, 05:17 PM   #3
dazdaz
Member
 
Registered: Aug 2003
Location: Europe
Distribution: RHEL, CentOS, Ubuntu
Posts: 333

Original Poster
Rep: Reputation: 17
Thanks, reading your comment about yum made me check the yum.conf and httpd was in the exclude list :-(

That's now fixed. I presume that httpd is in the exclude list so that you don't accidentally wipe out your web content :-)

Unfortunately the webserver still refuses to start up.

The error_log says :
Code:
[Tue Mar 13 00:21:14 2012] [notice] SSL FIPS mode disabled
[Tue Mar 13 00:21:14 2012] [warn] RSA server certificate CommonName (CN) `localhost' does NOT match server name!?
[Tue Mar 13 00:21:14 2012] [emerg] (28)No space left on device: Couldn't create accept lock (/var/log/httpd/accept.lock.9831) (5)
I read the following article and removed all Apache owned semaphores, but the same error is reported when I try to start it :
http://rackerhacker.com/2007/08/24/a...e-accept-lock/

Code:
service httpd configtest
[Tue Mar 13 00:59:52 2012] [crit] (22)Invalid argument: alloc_listener: failed to get a socket for (null)
Syntax error on line 136 of /etc/httpd/conf/httpd.conf:
Listen setup failed

Code:
# rpm -q httpd apr
httpd-2.2.15-15.el6.centos.1.i686
apr-1.3.9-3.el6_1.2.i686

# service httpd configtest
[Tue Mar 13 00:31:20 2012] [crit] (22)Invalid argument: alloc_listener: failed to get a socket for (null)
Syntax error on line 136 of /etc/httpd/conf/httpd.conf:
Listen setup failed
Line 136 says :
Code:
Listen 80
I also tried IP:80 which made no difference. I dont see the syntax error.

Last edited by dazdaz; 03-12-2012 at 05:18 PM.
 
Old 03-12-2012, 05:21 PM   #4
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
@ Reply

Paste the output of:

Code:
cat /etc/httpd/conf/httpd.conf
If possible paste the output of:

Code:
cat /etc/hosts
Do you get any syntax error when you run the following command:

Code:
httpd -t
 
Old 03-12-2012, 05:48 PM   #5
dazdaz
Member
 
Registered: Aug 2003
Location: Europe
Distribution: RHEL, CentOS, Ubuntu
Posts: 333

Original Poster
Rep: Reputation: 17
Hi, it's a stock configuration, so httpd should start up afaik, nothing has been changed. It did work originally and I could connect to the web server.

I will send you my hosts file privately if these files below are of no use.

Code:
httpd -t
[Tue Mar 13 01:37:13 2012] [crit] (22)Invalid argument: alloc_listener: failed to get a socket for (null)
Syntax error on line 136 of /etc/httpd/conf/httpd.conf:
Listen setup failed

Code:
# ipcs -s

------ Semaphore Arrays --------
key        semid      owner      perms      nsems

Code:
# sed -n '136,137p' /etc/httpd/conf/httpd.conf
Listen 80




# cat /etc/httpd/conf/httpd.conf | egrep -v '^#'


ServerTokens OS

ServerRoot "/etc/httpd"

PidFile run/httpd.pid

Timeout 60

KeepAlive Off

MaxKeepAliveRequests 100

KeepAliveTimeout 15


<IfModule prefork.c>
StartServers       8
MinSpareServers    5
MaxSpareServers   20
ServerLimit      256
MaxClients       256
MaxRequestsPerChild  4000
</IfModule>

<IfModule worker.c>
StartServers         4
MaxClients         300
MinSpareThreads     25
MaxSpareThreads     75
ThreadsPerChild     25
MaxRequestsPerChild  0
</IfModule>

Listen 80

LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_alias_module modules/mod_authn_alias.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule ldap_module modules/mod_ldap.so
LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
LoadModule include_module modules/mod_include.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule expires_module modules/mod_expires.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule headers_module modules/mod_headers.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule info_module modules/mod_info.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule substitute_module modules/mod_substitute.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule cache_module modules/mod_cache.so
LoadModule suexec_module modules/mod_suexec.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule version_module modules/mod_version.so


Include conf.d/*.conf


User apache
Group apache


ServerAdmin root@localhost


UseCanonicalName Off

DocumentRoot "/var/www/html"

<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>


<Directory "/var/www/html">

    Options Indexes FollowSymLinks

    AllowOverride None

    Order allow,deny
    Allow from all

</Directory>

<IfModule mod_userdir.c>
    #
    # UserDir is disabled by default since it can confirm the presence
    # of a username on the system (depending on home directory
    # permissions).
    #
    UserDir disabled

    #
    # To enable requests to /~user/ to serve the user's public_html
    # directory, remove the "UserDir disabled" line above, and uncomment
    # the following line instead:
    #
    #UserDir public_html

</IfModule>


DirectoryIndex index.html index.html.var

AccessFileName .htaccess

<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</Files>

TypesConfig /etc/mime.types

DefaultType text/plain

<IfModule mod_mime_magic.c>
    MIMEMagicFile conf/magic
</IfModule>

HostnameLookups Off



ErrorLog logs/error_log

LogLevel warn

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent


CustomLog logs/access_log combined

ServerSignature On

Alias /icons/ "/var/www/icons/"

<Directory "/var/www/icons">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

<IfModule mod_dav_fs.c>
    # Location of the WebDAV lock database.
    DAVLockDB /var/lib/dav/lockdb
</IfModule>

ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

<Directory "/var/www/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>


IndexOptions FancyIndexing VersionSort NameWidth=* HTMLTable Charset=UTF-8

AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip

AddIconByType (TXT,/icons/text.gif) text/*
AddIconByType (IMG,/icons/image2.gif) image/*
AddIconByType (SND,/icons/sound2.gif) audio/*
AddIconByType (VID,/icons/movie.gif) video/*

AddIcon /icons/binary.gif .bin .exe
AddIcon /icons/binhex.gif .hqx
AddIcon /icons/tar.gif .tar
AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
AddIcon /icons/a.gif .ps .ai .eps
AddIcon /icons/layout.gif .html .shtml .htm .pdf
AddIcon /icons/text.gif .txt
AddIcon /icons/c.gif .c
AddIcon /icons/p.gif .pl .py
AddIcon /icons/f.gif .for
AddIcon /icons/dvi.gif .dvi
AddIcon /icons/uuencoded.gif .uu
AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
AddIcon /icons/tex.gif .tex
AddIcon /icons/bomb.gif core

AddIcon /icons/back.gif ..
AddIcon /icons/hand.right.gif README
AddIcon /icons/folder.gif ^^DIRECTORY^^
AddIcon /icons/blank.gif ^^BLANKICON^^

DefaultIcon /icons/unknown.gif


ReadmeName README.html
HeaderName HEADER.html

IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t

AddLanguage ca .ca
AddLanguage cs .cz .cs
AddLanguage da .dk
AddLanguage de .de
AddLanguage el .el
AddLanguage en .en
AddLanguage eo .eo
AddLanguage es .es
AddLanguage et .et
AddLanguage fr .fr
AddLanguage he .he
AddLanguage hr .hr
AddLanguage it .it
AddLanguage ja .ja
AddLanguage ko .ko
AddLanguage ltz .ltz
AddLanguage nl .nl
AddLanguage nn .nn
AddLanguage no .no
AddLanguage pl .po
AddLanguage pt .pt
AddLanguage pt-BR .pt-br
AddLanguage ru .ru
AddLanguage sv .sv
AddLanguage zh-CN .zh-cn
AddLanguage zh-TW .zh-tw

LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW

ForceLanguagePriority Prefer Fallback

AddDefaultCharset UTF-8

AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl    .crl


AddHandler type-map var

AddType text/html .shtml
AddOutputFilter INCLUDES .shtml

Alias /error/ "/var/www/error/"

<IfModule mod_negotiation.c>
<IfModule mod_include.c>
    <Directory "/var/www/error">
        AllowOverride None
        Options IncludesNoExec
        AddOutputFilter Includes html
        AddHandler type-map var
        Order allow,deny
        Allow from all
        LanguagePriority en es de fr
        ForceLanguagePriority Prefer Fallback
    </Directory>


</IfModule>
</IfModule>

BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0

BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
BrowserMatch "MS FrontPage" redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^WebDAVFS/1.[0123]" redirect-carefully
BrowserMatch "^gnome-vfs/1.0" redirect-carefully
BrowserMatch "^XML Spy" redirect-carefully
BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully
 
Old 03-12-2012, 06:00 PM   #6
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
@ Reply

Compare the version of apr and httpd are they at the same level? If not then upgrade either of them to bring them both at the same level and then restart httpd services.

No need for /etc/hosts.

You can find out the version apr in the same way you did for httpd, that is:

Code:
rpm -qa | grep apr
 
Old 03-12-2012, 06:26 PM   #7
dazdaz
Member
 
Registered: Aug 2003
Location: Europe
Distribution: RHEL, CentOS, Ubuntu
Posts: 333

Original Poster
Rep: Reputation: 17
Hi, I can't see an update for apr but I did for CentOS 6.2 httpd, when I installed that, it made no difference.

Could you please be more specific with version numbers that I should sync or up/down-grade to, afaik all should work with the currently installed versions.

What do you mean by the same level, I can't see an update to apr.

Code:
# rpm -q httpd apr
httpd-2.2.15-15.el6.centos.1.i686
apr-1.3.9-3.el6_1.2.i686
Code:
http://mirrors.arsc.edu/centos/6.2/os/i386/Packages/httpd-2.2.15-15.el6.centos.i686.rpm
http://mirrors.arsc.edu/centos/6.2/os/i386/Packages/apr-1.3.9-3.el6_1.2.i686.rpm

http://mirrors.arsc.edu/centos/6.2/updates/i386/Packages/httpd-2.2.15-15.el6.centos.1.i686.rpm

# md5sum httpd-2.2.15-15.el6.centos.i686.rpm httpd-2.2.15-15.el6.centos.1.i686.rpm
4dcef12336a7ab179b9ecc6890fb5a89  httpd-2.2.15-15.el6.centos.i686.rpm
82897345a3a82ccc9f2be524f60d7c9a  httpd-2.2.15-15.el6.centos.1.i686.rpm
 
Old 03-12-2012, 06:47 PM   #8
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
@ Reply

From the output that you have pasted the version seems to be fine as I can see the same version online. But it appears that there is something wrong which I cannot pinpoint. Things that I can suggest are:

1. Make a backup of existing /etc/httpd directory.
2. Rename existing /etc/httpd directory /etc/httpd.old
3. Make a backup of existing /var/www directory.
4. Rename existing /var/www /var/www.old.
5. Remove apr (this will automatically remove httpd as well). Command:

Code:
yum remove apr
6. Check if the packages have been removed or not by running the following commands:

Code:
rpm -qa | grep apr
Code:
rpm -qa | grep httpd
7. Once verified that the packages have been removed. Install httpd (this will automatically install apr as well). Command:

Code:
yum install httpd
8. Check if you are able to start httpd services or not? If yes, then do not rename back earlier directories instead make the changes to existing file. Make sure you take a backup of new configuration files before making any changes.
 
1 members found this post helpful.
Old 03-13-2012, 06:07 AM   #9
dazdaz
Member
 
Registered: Aug 2003
Location: Europe
Distribution: RHEL, CentOS, Ubuntu
Posts: 333

Original Poster
Rep: Reputation: 17
In the end I re-staged the CentOS 6.2 box and noticed that the apr RPM version was lower to what I had above.

I hope that saves someone some pain and this can be used as a quick workaround.

Code:
# rpm -q apr httpd
apr-1.3.3-4.fc11.i586
httpd-2.2.15-15.el6.centos.1.i686
 
Old 03-19-2012, 12:40 AM   #10
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
This is on my RHEL 6.2 box
Code:
rpm -q apr httpd
apr-1.3.9-3.el6_1.2.x86_64
httpd-2.2.15-15.el6_2.1.x86_64
The point is, both should have 'el6'. NOT fc11 = Fedora (Core) 11 ...
 
  


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
httpd 2.2.4 rpms for CentOS/RHEL 5.x blue_print Linux - Software 4 05-03-2011 07:27 PM
CentOS 5 httpd upgrade vbsaltydog Red Hat 8 02-25-2011 05:56 AM
[SOLVED] centos 5.4 need to update apache/httpd hockeyman_102 Linux - Security 7 03-30-2010 12:47 PM
CentOS 5.3 - Too many httpd process sokha Linux - Server 7 03-12-2010 01:31 AM
How to Compile httpd-2.2.13 on CentOS 5.3? k_oudom Linux - Software 18 09-17-2009 02:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

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