Advertisement

Apache problem on Windows

Started by January 28, 2014 04:56 AM
0 comments, last by gamelife 11 years ago

I have recently installed Apache 2.4.7, PHP 5.5.8 and virtual hosts on Windows Vista.

Now I often experience a strange connection hangs problem:

(1) Open Chrome and Internet Explorer, both connect to one of the virtual hosts

(2) Repeatedly do some random actions and refreshes in both browsers
(3) After a while, the browsers will show "Connecting..." and hangs. When it happens, if I open a new tab and connect to another virtual host, it will also hang.
(4) The only way to solve the "Connecting..." status is to stop loading the initial page, and refresh the browser. After that, all other hanging connection to other virtual hosts can load.

The way I have setup virtual hosts is edit the file C:/WINDOWS/system32/drivers/etc/hosts and it looks like:


127.0.0.1       localhost
::1             localhost
127.0.0.1       dpi.vh.com
127.0.0.1       pi.vh.com
 

And I have edited the file httpd-vhosts.conf like this:


<Directory D:/wwwroot>
  Require all granted
</Directory>

<VirtualHost *:8080>
    ServerName localhost
    DocumentRoot "D:/wwwroot"
    <Directory "D:/wwwroot/">
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
    ErrorLog  "logs/localhost-error.log"
    CustomLog "logs/localhost-access.log" combined
</VirtualHost>

<VirtualHost *:8080>
    ServerName dpi.vh.com
    ServerAlias dpi.vh.com
    DocumentRoot "D:/wwwroot/dpi.vh-test.com/site/"
    AddDefaultCharset UTF-8
    SetEnv KOHANA_ENV PRODUCTION
    <Directory "D:/wwwroot/dpi.vh-test.com/site/">
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
    ErrorLog  "logs/dpi.vh-test.com-error.log"
    CustomLog "logs/dpi.vh-test.com-access.log" combined
</VirtualHost>

<VirtualHost *:8080>
    ServerName pi.vh.com
    ServerAlias pi.vh.com
    DocumentRoot "D:/wwwroot/pi.vh-test.com/site/"
    AddDefaultCharset UTF-8
    SetEnv KOHANA_ENV PRODUCTION
    <Directory "D:/wwwroot/pi.vh-test.com/site/">
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
    ErrorLog  "logs/pi.vh-test.com-error.log"
    CustomLog "logs/pi.vh-test.com-access.log" combined
</VirtualHost>

I have .htaccess file in both directories like this:


# Turn on URL rewriting
RewriteEngine On 

# Installation directory
RewriteBase /

# Protect hidden files from being viewed
<Files .*>
    Order Deny,Allow
    Deny From All
</Files>

# Protect application and system files from being viewed
RewriteRule ^(?:application|modules|system)\b.* index.php/$0 [L]

RewriteRule gallery_(.*).xml mread/detail/$1 [PT]

# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT]

I am sure the connection hangs problem is not due to the PHP code, since I have added a few lines at the start of index.php to write log into txt file, and when the "Connecting..." situation happens, nothing is written into the txt file.

When the connection from browser hangs, I have tried to ping the domain (dpi.vh.com, pi.vh.com) and telnet to the port (telnet dpi.vh.com 8080, telnet pi.vh.com 8080), and these all works.

Anyone knows what might be the reason?

(BTW, the sites are using Kohana 3.0... not sure if that's the cause)

To answer my own question, adding these lines to httpd.conf seems solve the problem.


AcceptFilter http none 
AcceptFilter https none 
EnableSendfile off 
EnableMMAP off

This topic is closed to new replies.

Advertisement