Version 2.2 of the Apache HTTP Server. When asking questions about virtualhosts, please include the output of the following command: "apache2ctl -S" (or "httpd -S" depending on your OS)

learn more… | top users | synonyms (3)

165
votes
11answers
34k views

Is it bad to redirect http to https?

I just installed an SSL Certificate on my server. I use a web hosting panel called ZPanel that is an open source project. It then set up a redirect for all traffic on my domain on Port 80 to ...
148
votes
3answers
97k views

What's the best way of handling permissions for apache2's user www-data in /var/www?

Has anyone got a nice solution for handling files in /var/www? We're running Name Based Virtual Hosts and the apache2 user is www-data. We've got two regular users & root. So when messing with ...
146
votes
5answers
23k views

Redirect, Change URLs or Redirect HTTP to HTTPS in Apache - Everything You Ever Wanted How to Know about Mod_Rewrite Rules but Were Afraid to Ask

This is a Canonical Question about Apache's mod_rewrite. Changing a request URL or redirecting users to a different URL than the one they originally requested is done using mod_rewrite. This ...
96
votes
4answers
73k views

What permissions should my website files/folders have on a Linux webserver?

This is a Canonical Question about File Permissions on a Linux web server. I have a Linux web server running Apache2 that hosts several websites. Each website has its own folder in /var/www/. ...
88
votes
2answers
32k views

How do I select which Apache MPM to use?

I'm a little confused between the different MPMs offered by Apache - 'worker', 'event', 'prefork', etc. What are the major differences between them, and how can I decide which one will be best for a ...
69
votes
5answers
41k views

Multiple SSL domains on the same IP address and same port?

This is a Canonical Question about Hosting multiple SSL websites on the same IP. I was under the impression that each SSL Certificate required it's own unique IP Address/Port combination. But the ...
62
votes
11answers
65k views

apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName

I keep getting this warning when I (re)start Apache. * Restarting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ...
62
votes
9answers
68k views

Dealing with HTTP w00tw00t attacks

I have a server with apache and I recently installed mod_security2 because I get attacked a lot by this: My apache version is apache v2.2.3 and I use mod_security2.c This were the entries from the ...
57
votes
7answers
96k views

Apache 2 startup warning: NameVirtualHost *:80 has no VirtualHosts

When my Ubuntu Apache server (Apache 2) starts up I get a warning message that reads: [warn] NameVirtualHost *:80 has no VirtualHosts However, the web server is working fine. What might I have ...
51
votes
8answers
100k views

What limits the maximum number of connections on a Linux server?

What kernel parameter or other settings control the maximum number of TCP sockets that can be open on a Linux server? What are the tradeoffs of allowing more connections? I noticed while load testing ...
47
votes
5answers
48k views

Which to install: Apache Worker or Prefork? What are the (dis-)advantages of each?

Based on the descriptions for both the Prefork and Worker MPM, it seems the prefork type is somewhat outdated, but I can't really find a proper comparison of the two types. What i'd like to know: ...
41
votes
12answers
49k views

Do you have any useful awk and grep scripts for parsing apache logs?

I can use log analyzers, but often I need to parse recent web logs to see what's happening at the moment. I sometimes do things like to figure out top 10 ips that request a certain file cat foo.log ...
37
votes
9answers
45k views

Finding out what user Apache is running as?

I want to secure a file upload directory on my server as described beautifully here, but I have one problem before I can follow these instructions. I don't know what user Apache is running as. I've ...
36
votes
7answers
17k views

How much of a performance hit for https vs http for apache?

Roughly how much of a performance hit will https take compared to http for the same page? Suppose I can handle 1000 requests/s for abc.php, how much will it decrease by when accessed through https? I ...
34
votes
5answers
35k views

Using variables in Apache config files to reduce duplication?

Is it possible to use variables in Apache config files? For example, when I'm setting up a site with Django+WSGI, the config file might look like: <Directory /path/to/foo/> Order ...
30
votes
4answers
80k views

Redirect URL within Apache VirtualHost?

I have a dedicated server with Apache, on which I've set up some VirtualHosts. I've set up one to handle the www domain as well as the non-www domain. My VH .conf file for the www: <VirtualHost ...
30
votes
4answers
22k views

ubuntu apache: httpd.conf or apache2.conf?

which one of these 2 files should i use to configure apache? the httpd.conf is empty while apache2.conf is not. it confuses me!
30
votes
5answers
46k views

Why are docx, xlsx, pptx downloading from webserver as zip files?

On my Apache server I have stored several docx, xlsx pptx files. Some client browsers think that theses are regular zip files and change the file extension when downloading. How do I make it not do ...
30
votes
4answers
41k views

Setup ubuntu server to send mail()

I tried searching a lot but unable to find how to actually setup a ubuntu server, so that I can send mails through php using mail() function in php. I have apache2, mysql and php5 installed on my ...
29
votes
7answers
55k views

Why is the response on localhost so slow?

I am working on a tiny little PHP project for a friend of mine, and I have a WAMP environment setup for local development. I remember the days when the response from my local Apache 2.2 was immediate. ...
28
votes
8answers
3k views

Securing PHP webservers

PHP applications have a reputation for higher than average security problems. What configuration techniques do you use for making sure the application is secure as possible? I'm looking for ideas ...
27
votes
6answers
76k views

How to configure basic authentication in Apache httpd virtual hosts?

I'm trying to configure mercurial access using Apache http. It requires authentication. My /etc/apache2/sites-enabled/mercurial looks like this: NameVirtualHost *:8080 <VirtualHost *:8080> ...
27
votes
9answers
28k views

How to reduce memory usage on a Unix webserver

I'm currently using a Joyent Accelerator to host my webapps, and it's working fine, however I need to reduce costs so I'm downgrading my current plan and that imposes some new memory limits (256M rss, ...
27
votes
6answers
17k views

How to best defend against a “slowloris” DOS attack against an Apache web server?

Recently a script called "slowloris" has gained attention. The basic concept of what slowloris does is not a new attack but given the recent attention I have seen a small increase in attacks against ...
26
votes
7answers
10k views

Why is Nginx so fast?

How does a site like rambler serve dynamic content so fast? Even faster than Yahoo (which has a server in my country- SE Asia; rambler does not). Is this purely Nginx’s capability? Where should I ...
26
votes
4answers
24k views

Configuring Apache2 to proxy WebSocket?

The WebSocket protocol is an extension of the HTTP protocol. However, the proxy module of Apache2 does not seem to know about it, and throws away crucial headers, converting the call to a standard ...
25
votes
7answers
32k views

Apache Default/Catch-All Virtual Host?

If I have 3 domains, domain1.com, domain2.com, and domain3.com, is it possible to set up a default virtual host to domains not listed? For example, if I would have: <VirtualHost 192.168.1.2 ...
25
votes
3answers
7k views

Apache vs Nginx

I have been investigating the differences between Apache and Nginx recently and am confused about which I should choose. I have done some searching but there is no definitive comparison between the ...
25
votes
14answers
3k views

Load-balancer options [closed]

I am looking at a number of possible options for load-balancing. So far, I am constrained to the following options: DNS server load-balancer, balancing to a cluster of tomcat servers, with ...
24
votes
2answers
551 views

Retrieving an RSA key from a running instance of Apache?

I created an RSA keypair for an SSL certificate and stored the private key in /etc/ssl/private/server.key. Unfortunately this was the only copy of the private key that I had. Then I accidentally ...
22
votes
5answers
29k views

Where is apc.php?

Using Ubuntu server 10.4, I apt-getted php-apc Where is the apc.php file that I'm meant to copy? Thanks!
22
votes
5answers
4k views

A domain I've never heard of resolves to my website [duplicate]

I've discovered (via looking at mod_pagespeed cache entries) that a completely random domain I've never heard of before is resolving to my website. If I visit this domain, my website loads. The DNS ...
22
votes
7answers
33k views

How to set up Mod_WSGI for Python on Ubuntu

I am trying to setup MOD_WSGI on my Ubuntu box. I have found steps that said I needed to do the following steps I found at http://ubuntuforums.org/showthread.php?t=833766 sudo apt-get install ...
21
votes
7answers
12k views

How do I prevent apache from serving the .git directory?

I have started using git for deployment of websites for testing. How do I prevent apache from serving the .git directory contents? I tried <Directorymatch "^/.*/\.git/"> Order deny,allow Deny ...
21
votes
4answers
38k views

How can I solve the apache2 httpd error “mixing * ports and non-* ports with a NameVirtualHost address is not supported”

Here is the error I get when booting up Apache2: * Starting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName [Wed ...
21
votes
3answers
22k views

Purpose of debian “sites-available” and “sites-enabled” dirs

I'm a noob, please be nice. Can anyone tell me, in a nutshell, what the purpose of these two directories are in Debian? /etc/apache2/sites-enabled /etc/apache2/sites-available I notice that ...
21
votes
3answers
60k views

Proxy Error 502 “Reason: Error reading from remote server” with Apache 2.2.3 (Debian) mod_proxy and Jetty 6.1.18

Apache is receiving requests at port :80 and proxying them to Jetty at port :8080 The proxy server received an invalid response from an upstream server The proxy server could not handle the request ...
20
votes
3answers
7k views

PHP: What are the advantages of FastCGI over mod_php?

It was recently suggested to me that I use FastCGI with PHP. Now I went to the FastCGI page and read it but I don't really understand what the advantages are.
20
votes
11answers
41k views

Subversion error: Repository moved permanently to please relocate

I've set up subversion and apache on my server. If I browse to it through my webbrowser it works fine (http://svn.host.com/reposname). However, if I do a checkout on my machine I get the following ...
19
votes
9answers
13k views

Multiple domains with SSL on same IP

I know that a dedicated IP is needed for setting up SSL. What happens if we add SSL for domains sharing an IP ? (Namevirtualhost)
19
votes
1answer
4k views

Apache ab: please explain the output

I've looked around, and can't find any detailed explanation of the output at all. Most is indeed easy to understand, but there is one part that flummoxes me: Time per request: 109537.505 [ms] ...
19
votes
3answers
544 views

Suspicious .htaccess File

This was uploaded to one of my FTP folders. I'm not familiar with Apache, but still curious - can someone tell me what type of dastardly act this file is trying to commit? Thanks! RewriteEngine On ...
19
votes
3answers
42k views

Optimal values for ServerLimit, MaxClients, MaxRequestsPerChild directives

I'm running a traffic intense site plenty of dynamic content, mostly user-generated. The server is a dedicated one and has a total of 4 Intel(R) Xeon(R) CPU X3210 @ 2.13GHz proccesors. I need to know ...
18
votes
4answers
11k views

Do Apache config files support block commenting?

You can use # to comment out individual lines. Is there a syntax for commenting out entire blocks? I've tired surrounding the block (specifically a <Directory> block) with <IfModule ...
17
votes
3answers
3k views

Run multiple servers on the same port

I would like to run a XAMPP server, and a Nodejs server on the port 80. If the server get a HTTP request, then XAMPP will handle it, if the server get a Websocket request, then Nodejs How is it ...
17
votes
3answers
5k views

SSL password on apache2 restart

I setup wildcard SSL certificate from Godaddy on Apache2. Whenever the server restarts it asks for the passphrase for the SSL certificate's private key. What's the best way to remove this obstacle ...
17
votes
6answers
13k views

Optimize apache/php/mysql running on VPS for heavy load

Question about optimizing an apache/mysql server on a VPS with 512m of RAM. Under normal load everything runs fast, no connection lag. However when we get our heavy traffic days (50k+ visits) the ...
17
votes
8answers
11k views

How can I see how much bandwidth each Apache Virtual Host is using?

I have Apache set up to serve several Virtual Hosts, and I would like to see how much bandwidth each site uses. I can see how much the entire server uses, but I would like more detailed reports. ...
17
votes
7answers
42k views

Apache+Tomcat having problems communicating. Unclear error messages. Bringing down websites hosted under Tomcat

Setup: Fedora 8 Apache 2.2.8 Tomcat 5.5.8 Apache is forwarding requests using AJP. Problem: After a certain period of time (no constant at all, can be between an hour or two, or one or more days) ...
17
votes
2answers
6k views

Google SPDY - Has anyone used it on Apache?

Just wondering if anyone has had any experience with Google SPDY on Apache? http://code.google.com/p/mod-spdy/ I run a couple of web servers and am interested to know if there have been any issues ...