# [SOLVED]Can't connect to localhost with apache using 802.1x

## nowheremansq

Hello all, 

     I met a strange problem with my apache. I connect to internet through IEEE 802.1x protocol in my university, but when I start my apache, I even cannot connect to localhost! Not to mention connected by others. The httpd.conf is the default setting without any change except adding "-D PHP5". Anyone know HOWTO solve it?  By the way, my 80 port event not respond after apache2 start. In my view, the 80 port should be automatically active with apache2 start.

Thx~~~

my BlogLast edited by nowheremansq on Fri May 06, 2011 8:43 am; edited 1 time in total

----------

## audiodef

Your localhost has nothing to do with eth or wlan. FYI.   :Wink: 

Check /var/log/apache2/error.log. Post it here if you don't know what you're looking at. Something isn't configured right with your apache.

----------

## nowheremansq

 *audiodef wrote:*   

> Your localhost has nothing to do with eth or wlan. FYI.  
> 
> Check /var/log/apache2/error.log. Post it here if you don't know what you're looking at. Something isn't configured right with your apache.

 

Thanks for your reply!

This is my error_log:

```
[Wed Jan 19 12:01:32 2011] [alert] (EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of "Gentoo"

Configuration Failed

[Wed Jan 19 12:02:00 2011] [alert] (EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of "Gentoo"

Configuration Failed

[Wed Jan 19 12:02:52 2011] [alert] (EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of "Gentoo"

Configuration Failed

[Wed Jan 19 12:05:35 2011] [alert] (EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of "Gentoo"

Configuration Failed

[Wed Jan 19 12:08:35 2011] [alert] (EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of "Gentoo"

Configuration Failed

[Wed Jan 19 12:16:17 2011] [alert] (EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of "Gentoo"

Configuration Failed

[Wed Jan 19 12:27:47 2011] [alert] (EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of "Gentoo"

Configuration Failed

[Wed Jan 19 12:54:09 2011] [alert] (EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of "Gentoo"

Configuration Failed

[Wed Jan 19 12:56:05 2011] [alert] (EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of "Gentoo"

Configuration Failed

[Wed Jan 19 13:04:15 2011] [alert] (EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of "Gentoo"

Configuration Failed

[Wed Jan 19 13:14:46 2011] [alert] (EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of "Gentoo"

Configuration Failed

[Wed Jan 19 14:18:52 2011] [alert] (EAI 3)Temporary failure in name resolution: mod_unique_id: unable to find IPv4 address of "Gentoo"

Configuration Failed

[Wed Jan 19 14:20:17 2011] [alert] (EAI 3)Temporary failure in name resolution: mod_unique_id: unable to find IPv4 address of "Gentoo"

Configuration Failed

[Wed Jan 19 14:23:43 2011] [alert] (EAI 3)Temporary failure in name resolution: mod_unique_id: unable to find IPv4 address of "Gentoo"

Configuration Failed

[Wed Jan 19 14:37:31 2011] [alert] (EAI 3)Temporary failure in name resolution: mod_unique_id: unable to find IPv4 address of "Gentoo"

Configuration Failed

[Wed Jan 19 16:14:27 2011] [alert] (EAI 3)Temporary failure in name resolution: mod_unique_id: unable to find IPv4 address of "Gentoo"

Configuration Failed

[Wed Jan 19 16:19:19 2011] [alert] (EAI 3)Temporary failure in name resolution: mod_unique_id: unable to find IPv4 address of "Gentoo"

Configuration Failed

[Wed Jan 19 17:29:21 2011] [notice] Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.8o configured -- resuming normal operations

[Wed Jan 19 17:29:26 2011] [notice] caught SIGTERM, shutting down

[Wed Jan 19 17:29:31 2011] [notice] Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.8o configured -- resuming normal operations

[Wed Jan 19 17:30:09 2011] [error] [client 127.0.0.1] File does not exist: /var/www/localhost/htdocs/favicon.ico

[Wed Jan 19 17:30:25 2011] [notice] caught SIGTERM, shutting down
```

And this is my httpd.conf:

```
# This is a modification of the default Apache 2.2 configuration file

# for Gentoo Linux.

#

# Support:

#   http://www.gentoo.org/main/en/lists.xml   [mailing lists]

#   http://forums.gentoo.org/                 [web forums]

#   irc://irc.freenode.net#gentoo-apache      [irc chat]

#

# Bug Reports:

#   http://bugs.gentoo.org                    [gentoo related bugs]

#   http://httpd.apache.org/bug_report.html   [apache httpd related bugs]

#

#

# This is the main Apache HTTP server configuration file.  It contains the

# configuration directives that give the server its instructions.

# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.

# In particular, see

# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>

# for a discussion of each configuration directive.

#

# Do NOT simply read the instructions in here without understanding

# what they do.  They're here only as hints or reminders.  If you are unsure

# consult the online docs. You have been warned.

#

# Configuration and logfile names: If the filenames you specify for many

# of the server's control files begin with "/" (or "drive:/" for Win32), the

# server will use that explicit path.  If the filenames do *not* begin

# with "/", the value of ServerRoot is prepended -- so "var/log/apache2/foo_log"

# with ServerRoot set to "/usr" will be interpreted by the

# server as "/usr/var/log/apache2/foo.log".

# ServerRoot: The top of the directory tree under which the server's

# configuration, error, and log files are kept.

#

# Do not add a slash at the end of the directory path.  If you point

# ServerRoot at a non-local disk, be sure to point the LockFile directive

# at a local disk.  If you wish to share the same ServerRoot for multiple

# httpd daemons, you will need to change at least LockFile and PidFile.

ServerRoot "/usr/lib/apache2"

# Dynamic Shared Object (DSO) Support

#

# To be able to use the functionality of a module which was built as a DSO you

# have to place corresponding `LoadModule' lines at this location so the

# directives contained in it are actually available _before_ they are used.

# Statically compiled modules (those listed by `httpd -l') do not need

# to be loaded here.

#

# Example:

# LoadModule foo_module modules/mod_foo.so

#

# GENTOO: Automatically defined based on APACHE2_MODULES USE_EXPAND variable.

#         Do not change manually, it will be overwritten on upgrade.

#

# The following modules are considered as the default configuration.

# If you wish to disable one of them, you may have to alter other

# configuration directives.

#

# Change these at your own risk!

LoadModule actions_module modules/mod_actions.so

LoadModule alias_module modules/mod_alias.so

LoadModule auth_basic_module modules/mod_auth_basic.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 authn_file_module modules/mod_authn_file.so

<IfDefine AUTHNZ_LDAP>

LoadModule authnz_ldap_module modules/mod_authnz_ldap.so

</IfDefine>

LoadModule authz_dbm_module modules/mod_authz_dbm.so

LoadModule authz_default_module modules/mod_authz_default.so

LoadModule authz_groupfile_module modules/mod_authz_groupfile.so

LoadModule authz_host_module modules/mod_authz_host.so

LoadModule authz_owner_module modules/mod_authz_owner.so

LoadModule authz_user_module modules/mod_authz_user.so

LoadModule autoindex_module modules/mod_autoindex.so

<IfDefine CACHE>

LoadModule cache_module modules/mod_cache.so

</IfDefine>

LoadModule cgi_module modules/mod_cgi.so

LoadModule cgid_module modules/mod_cgid.so

<IfDefine DAV>

LoadModule dav_module modules/mod_dav.so

</IfDefine>

<IfDefine DAV>

LoadModule dav_fs_module modules/mod_dav_fs.so

</IfDefine>

<IfDefine DAV>

LoadModule dav_lock_module modules/mod_dav_lock.so

</IfDefine>

LoadModule deflate_module modules/mod_deflate.so

LoadModule dir_module modules/mod_dir.so

<IfDefine CACHE>

LoadModule disk_cache_module modules/mod_disk_cache.so

</IfDefine>

LoadModule env_module modules/mod_env.so

LoadModule expires_module modules/mod_expires.so

LoadModule ext_filter_module modules/mod_ext_filter.so

<IfDefine CACHE>

LoadModule file_cache_module modules/mod_file_cache.so

</IfDefine>

LoadModule filter_module modules/mod_filter.so

LoadModule headers_module modules/mod_headers.so

LoadModule include_module modules/mod_include.so

<IfDefine INFO>

LoadModule info_module modules/mod_info.so

</IfDefine>

<IfDefine LDAP>

LoadModule ldap_module modules/mod_ldap.so

</IfDefine>

LoadModule log_config_module modules/mod_log_config.so

LoadModule logio_module modules/mod_logio.so

<IfDefine CACHE>

LoadModule mem_cache_module modules/mod_mem_cache.so

</IfDefine>

LoadModule mime_module modules/mod_mime.so

LoadModule mime_magic_module modules/mod_mime_magic.so

LoadModule negotiation_module modules/mod_negotiation.so

LoadModule rewrite_module modules/mod_rewrite.so

LoadModule setenvif_module modules/mod_setenvif.so

LoadModule speling_module modules/mod_speling.so

<IfDefine SSL>

LoadModule ssl_module modules/mod_ssl.so

</IfDefine>

<IfDefine STATUS>

LoadModule status_module modules/mod_status.so

</IfDefine>

LoadModule unique_id_module modules/mod_unique_id.so

<IfDefine USERDIR>

LoadModule userdir_module modules/mod_userdir.so

</IfDefine>

LoadModule usertrack_module modules/mod_usertrack.so

LoadModule vhost_alias_module modules/mod_vhost_alias.so

# If you wish httpd to run as a different user or group, you must run

# httpd as root initially and it will switch.

#

# User/Group: The name (or #number) of the user/group to run httpd as.

# It is usually good practice to create a dedicated user and group for

# running httpd, as with most system services.

User apache

Group apache

# Supplemental configuration

#

# Most of the configuration files in the /etc/apache2/modules.d/ directory can

# be turned on using APACHE2_OPTS in /etc/conf.d/apache2 to add extra features

# or to modify the default configuration of the server.

#

# To know which flag to add to APACHE2_OPTS, look at the first line of the

# the file, which will usually be an <IfDefine OPTION> where OPTION is the

# flag to use.

Include /etc/apache2/modules.d/*.conf

# Virtual-host support

#

# Gentoo has made using virtual-hosts easy. In /etc/apache2/vhosts.d/ we

# include a default vhost (enabled by adding -D DEFAULT_VHOST to

# APACHE2_OPTS in /etc/conf.d/apache2).

Include /etc/apache2/vhosts.d/*.conf

# vim: ts=4 filetype=apache

ServerName localhost
```

What is the problem?

Thanks for your help~~~  :Very Happy: 

----------

## audiodef

```

[Wed Jan 19 16:19:19 2011] [alert] (EAI 3)Temporary failure in name resolution: mod_unique_id: unable to find IPv4 address of "Gentoo"

Configuration Failed 

```

 :Shocked: 

Can you ping localhost? What happens when you do ping -c3 localhost?

Also, what do you actually see in your browser when you type "localhost" into your browser's address bar?

----------

## nowheremansq

 *audiodef wrote:*   

> 
> 
> ```
> 
> [Wed Jan 19 16:19:19 2011] [alert] (EAI 3)Temporary failure in name resolution: mod_unique_id: unable to find IPv4 address of "Gentoo"
> ...

 

I can ping localhost with 0% packet loss.

When I type "localhost",  the browser just say "can't connect to localhost server". What is the problem?

By the way, the IEEE 802.1x protocol is not a WLAN protocol. Some universities use it in dorm.

----------

## audiodef

Hm. Try this: delete /var/log/apache2/error_log, and do /etc/init.d/apache2 restart. Post the output from the restart. Go to localhost in your browser. Re-post the contents of error_log.

----------

## nowheremansq

 *audiodef wrote:*   

> Hm. Try this: delete /var/log/apache2/error_log, and do /etc/init.d/apache2 restart. Post the output from the restart. Go to localhost in your browser. Re-post the contents of error_log.

 

Sorry Sir, I'm not in my school now because of the winter vacation. It is a pity that the IEEE 802.1x cannot be used in my house. I will be back to my university after about 2 weeks and I will try what you say at that time. After that, I will reply this post again and ask for your help.

Thanks for your help!!  :Very Happy: 

----------

## audiodef

De nada.   :Cool: 

Does apache localhost work for you at home, then?

----------

## nowheremansq

 *audiodef wrote:*   

> De nada.  
> 
> Does apache localhost work for you at home, then?

 

Well, the way I connect to internet at home is ADSL , I can connect to localhost at home with the same httpd.conf, so I feel that the error may be happen only when I use IEEE 802.1x to connect.

Actually, you know, I come from China, the internet servicer in my country close user's port 80 to establish personal server because they are afraid that people will publish statements of politics   :Embarassed:  , so no one except myself can connect to my server at home, but I know the reason why. However, I don't know the reason why I even cannot connect to localhost through 802.1x. Actually, my classmate establish a server in dorm using Ubuntu, others can connect to it, so I confirm that this protocol itself don't have error.  :Very Happy: 

----------

## audiodef

That's interesting. You should be able to connect to localhost without even having any internet connection at all. It is, after all, localhost. 

Which makes me want to double check: are you trying to connect to localhost from the same machine apache is running on?

----------

## nowheremansq

 *audiodef wrote:*   

> That's interesting. You should be able to connect to localhost without even having any internet connection at all. It is, after all, localhost. 
> 
> Which makes me want to double check: are you trying to connect to localhost from the same machine apache is running on?

 

Yes, I connect to the same machine~~~ :Very Happy:   ~~   I also wonder why I cannot connect to myself  :Crying or Very sad: 

Do your have any other way such as Gtalk or some IM software to contact, Sir? The router of 802.1x seldom change my IP through dhcp in my university. When I come back to school, may I connect to you and tell you my IP? I feel at that time I can always keep my computer from shutting down and ask for your help through SSH?

 :Laughing: 

----------

## audiodef

These forums are the best way for me to try to help others. 

I just checked something out. What web browser are you using?

----------

## nowheremansq

 *audiodef wrote:*   

> These forums are the best way for me to try to help others. 
> 
> I just checked something out. What web browser are you using?

 

I use both firefox and chromium. In my view, it's not the problem of browser. Actually, after the apache is started, the netstat show that the 80 port even not listening !

----------

## audiodef

It may actually be a browser problem. Yesterday, I went looking for info on making sure apache localhost works without an internet connection, whether wired or wireless. I came across some info about Firefox. Apparently, you have to put Firefox into offline mode to access localhost with no internet connection. 

I tried this myself by doing the following:

1. /etc/init.d/net.eth0 stop

2. Open localhost in Firefox. I got unable to connect messages

3. In Firefox, File -> Work Offline

4. Reload localhost. It worked

Try this and let me know what happens.

----------

## nowheremansq

 *audiodef wrote:*   

> It may actually be a browser problem. Yesterday, I went looking for info on making sure apache localhost works without an internet connection, whether wired or wireless. I came across some info about Firefox. Apparently, you have to put Firefox into offline mode to access localhost with no internet connection. 
> 
> I tried this myself by doing the following:
> 
> 1. /etc/init.d/net.eth0 stop
> ...

 

Excuse me, I have been quite busy recently so I haven't check my E-mail these day  :Embarassed: 

I tried as what you said. After doing so, firefox just told me that because firefox is working offline, cannot browse the website pages.

 :Crying or Very sad: 

----------

## chiefbag

Post the output of the following command, note you must be logged in as root.

netstat -apn | grep apache

If you get no output then Apache is not running, simple as that!

If its not running then you need to check the apache logs as previously suggested to see whats happening.

Also enable debug logging for more info.

----------

## audiodef

 *nowheremansq wrote:*   

> 
> 
> Excuse me, I have been quite busy recently so I haven't check my E-mail these day 
> 
> I tried as what you said. After doing so, firefox just told me that because firefox is working offline, cannot browse the website pages.
> ...

 

That's odd. You wouldn't be able to get to, say, gentoo.org or google.com, but you should be able to access localhost in offline mode. 

Do what chiefbag says and we'll see what's what.

----------

## Raptor85

What exactly are you typing into the address bar on firefox to get to localhost? And does it maybe work with 127.0.0.1 instead?  You can get to localhost without even having network hardware on your machine, it's not routed, so the 802.1x shouldn't have anything to do with it.

also, please post the contents of /etc/conf.d/apache , if something is wrong with apache first place I would check is to make sure the vhosts are being loaded.

----------

## darkphader

 *nowheremansq wrote:*   

> 
> 
> And this is my httpd.conf:
> 
> ```
> ...

 

For one, you should not have this last line "ServerName localhost" here as you're "including" the /etc/apache2/vhosts.d/*.conf files of which 00_default_vhost.conf contains that information properly inside a VirtualHost container (unless you've screwed with that).

From the logs it appears that the system is looking for "Gentoo" and not "localhost". Have you edited any of the files in /etc/apache2/vhosts.d/ ?

Chris

----------

## nowheremansq

Hello All,

I'm sooo sorry that I haven't reply this post for such a long time because of my busy life.

THANK YOU SOOO much for all your helps~~

Finally, I solved this problem by edit my /etc/hosts file:

From

```
::1   localhost

127.0.0.1 localhost
```

To:

```
::1   Gentoo.homenetwork Gentoo localhost

127.0.0.1 lGentoo.homenetwork Gentoo localhost
```

And everything work well now

----------

## Killerchronic

 *Quote:*   

> Temporary failure in name resolution: mod_unique_id: unable to find IPv4 address of

 

This is the key to solving this one. I just had this myself, i always seem to forget to edit /etc/hosts lol

Edit: Bah sorry, misread the year on the first post   :Surprised: 

----------

