Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Files in my server can be accessed..only once at a time

Status
Not open for further replies.

Stoyicker

Programmer
Mar 17, 2013
1
ES
I have a tiny "webpage" in an Apache server running on my computer. I've got for it this .htaccess file:

Code:
<filesMatch "\.(html|htm|js|css)$">
FileETag None
<ifModule mod_headers.c>
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
Header add Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type,     javascript, swf"
Header add Access-Control-Allow-Methods "GET"
</ifModule>
</filesMatch>
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
<filesMatch "\.(?i:png|mp4|html|js|css|php)$">  
Order Allow,Deny
Allow from all
</filesMatch>

I have written it by googling, and though I'm not really sure it's ok (I don't really know very much about Apache HTTPD, but my Java suite requires this stuff, so here I am). Supposedly the first paragraph is to avoid Google Chrome from caching my files and the second part (the Order sentences) are to allow anyone to view only those kinds of files (which is otherwise let them see everything but folder roots - I guess there's some way to do this shorter/better, so if somebody knows, it's appreciated).

And here is the httpd.conf, which I've modified almost only to change the listen port, the server name, and to replace the AllowOverride None into AllowOverride All so that .htaccess is actually used (I've deleted the comments for readability).

Code:
ServerRoot "C:/Users/Jorge/Desktop/Apache"

Listen 57500

LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authn_file_module modules/mod_authn_file.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_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule include_module modules/mod_include.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule setenvif_module modules/mod_setenvif.so

<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>

User daemon
Group daemon

</IfModule>
</IfModule>

ServerAdmin [b]MYGMAILADDR[/b]

ServerName Fragments

DocumentRoot "C:/Users/Jorge/Desktop/Apache/htdocs"

<Directory />
    Options FollowSymLinks
    AllowOverride All
    Order deny,allow
    Deny from all
</Directory>

<Directory "C:/Users/Jorge/Desktop/Apache/htdocs">
    Options Indexes FollowSymLinks

    AllowOverride All

    Order allow,deny
    Allow from all

</Directory>

<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

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

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" common

</IfModule>

<IfModule alias_module>
    ScriptAlias /cgi-bin/ "C:/Users/Jorge/Desktop/Apache/cgi-bin/"

</IfModule>

<IfModule cgid_module>
</IfModule>

<Directory "C:/Users/Jorge/Desktop/Apache/cgi-bin">
    AllowOverride All
    Options None
    Order allow,deny
    Allow from all
</Directory>

DefaultType text/plain

<IfModule mime_module>
    TypesConfig conf/mime.types

    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

</IfModule>

<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

The thing is, I don't know why, I had never heard of something similar, "I can only load one instance of each file". In explanation, the only html file there's, runs from time to time a PHP script. Let's say I run it on localhost for example. Then everything is going fine. But I open a new tab, and load the same page (while the another one is yet open), and I'll get a 412 HTTP error. Similar thing happens if I try to load the webpage from another device. And, with my little experience with Apache HTTPD, I guess it's because of this .htaccess or httpd.conf files. Anyone knows why does this happen or how can I solve it (either it be or not related to one of these files, I'll do whatever is needed)?

Apache 2.2.22 which can be found here in Windows 8 x86.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top