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)

141
votes
5answers
20k 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 ...
88
votes
4answers
61k 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/. ...
67
votes
5answers
40k 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 ...
144
votes
3answers
92k 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 ...
2
votes
3answers
7k views

FTP and Apache permission issues

Im having issues as to which user should own my www directory - ftp or apache? When set to the ftp user, the user can add, remoe and easily modify files but php file system actions generate permission ...
87
votes
2answers
29k 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 ...
18
votes
9answers
12k 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)
2
votes
1answer
57 views

Hosting multiple distinct folders for distinct domains

I have a VPS that I've installed a Apache Web Server on. What I want to do is forward my own website domains to that server and host those websites' files inside my Apache Web Server. As far as I ...
50
votes
8answers
96k 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 ...
25
votes
7answers
30k 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 ...
10
votes
2answers
6k views

SSL site not using the correct IP in Apache and Ubuntu

I'm trying to set up an apache-ubuntu-php webserver. My webserver will host multiple SSL sites, each SSL site will have it's own IP address (unless there's a better way to do this). So I suppose the ...
10
votes
3answers
3k views

Secure LAMP server for production use

What is the procedure for securing a Linux, Apache, MySQL, PHP Server (or even Perl) for production use? Other than setting the MySQL password and the root password for Linux what other (maybe not so ...
10
votes
3answers
1k views

Apache: Scammers point dozens of domain names at my dedicated IP. How to prevent this?

For the sake of discussion, pretend that I have an Apache webserver which serves a website at www.example.org. This domain name resolves to the public IP address at 192.168.1.100 (pretend this is a ...
8
votes
2answers
385 views

How do I prevent Apache from answering requests for domains I don't host?

Someone has pointed their domain (www.bomberball.net) to the same IP as my domain (www.kapparate.com) , and Google is now showing the former when searching for Kapparate, rather than the latter. ...
4
votes
2answers
2k views

How to fetch ./configure parameters used at last time?

I am upgrading LAMP stack on customer's server and need to ./configure mysql and apache with exact last settings they were compiled with last time. Where do I get these? PHP configure string can be ...
0
votes
1answer
94 views

Two domains (when SSL) on same directory

My apache2 configuration is problematic: I've two website on a server: domain1.tdl domain2.tdl One of them (domain2.tdl) must be and is accessible on port 443 (with SSL). All domains must be and ...
14
votes
4answers
16k views

How do I redirect subdomains to a different port on the same server?

I have some subdomains I want to redirect to specific ports on the same server. Say I have dev.mydomain.com I want dev.mydomain.com to redirect to mydomain.com:8080 how do I do this with Apache ...
8
votes
5answers
2k views

How to prevent hot linking (“image theft” / “bandwidth theft”) of ressources on my site?

I'm trying to write the "ultimate" anti hot linking .htaccess... You can find many examples/tutorials/generators on the net but many of them are wrong or incomplete (or even both). These are the ...
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 ...
15
votes
3answers
29k views

How to redirect root and only root via htaccess?

I want to redirect only my root to another url, but maintain all the /sub/directories where they belong (and redirect) example: mysite.com/1 redirects to somewhere mysite.com/admin opens a page i ...
2
votes
1answer
862 views

How much free memory should I have on my webserver? [duplicate]

I have a webserver that's currently hosting two Wordpress sites and some java-based collaboration software. The server has 2G of memory and is currently using about 1.8G of the available memory. ...
3
votes
4answers
4k views

Is it Possible to view my apache server (local host) from home or remote computer that is outside my LAN?

i am developing a website and need to share progress with other stakeholders. Is it Possible to view my apache server (local host) from home or remote computer that is outside my LAN?
38
votes
12answers
46k 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 ...
27
votes
6answers
16k 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 ...
14
votes
5answers
3k views

What is the best way to monitor a production server?

We are running two production servers with Apache 2 and MySQL. I am looking for a reliable way of monitoring our load, stability and uptime. I have come across monit, but are there better ...
14
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 ...
10
votes
8answers
31k views

How do I install PHP 5.3 on CentOS?

I have to install PHP 5.3 on my CentOS server. If I do yum install php, the base repository installs 5.1.6 which is too old for the applications I need to install. So I've been trying to use the IUS ...
4
votes
2answers
7k views

How does ServerName and ServerAlias work?

It's the following part of a virtual host config that I need further clarification on: <VirtualHost *:80> # Admin email, Server Name (domain name), and any aliases ServerAdmin ...
4
votes
5answers
8k views

What causes PHP pages to consistently download instead of running normally

I'm running a Ubuntu Server on a VM, to test out different web forum solutions. I have set up a ~/public_html/ to be accessible with the apache2 web server, and that works fine. However when I go to ...
9
votes
4answers
15k views

How do I set up per-site php.ini files on a LAMP server using NameVirtualHosts?

I have a LAMP server serving a number of different websites using NameVirtualHosts. Until recently having a global php.ini file has been just fine, but recently one of our developers has requested ...
4
votes
1answer
285 views

How to stop HTTPS requests for non-ssl-enabled virtual hosts from going to the first ssl-enabled virtualhost (Apache-SNI)

I hope that title is clear. How do I prevent HTTPS requests for non-ssl-enabled virtual hosts from going to the first ssl-enabled virtualhost (setup is Apache-SNI). For example, using my abbreviated ...
3
votes
1answer
2k views

What is Apache's equivalent of Nginx's try_files?

In Nginx there is try_files, a config directive that "checks for the existence of files in order, and returns the first file that is found". I find it very neat to do this location ~* ...
4
votes
3answers
4k views

What are these weird access requests?

I using WAMPServer on my computer for testing and development. I forgot and left it online for a few days and I notice a bunch of random requests that aren't even from my IP. Here are some examples. ...
3
votes
5answers
2k views

Enable access without “www.” on Ubuntu

I want to enable the access to my site without the "www." prefix. I tried to insert this in my /etc/apache2/sites-available file: <VirtualHost *:80> serverName mydomain.gov.br ...
3
votes
4answers
2k views

Domain without the 'www.' gives me the Apache 'It works!' page

When I enter in my domain like this www.domain.com everything works fine. But when I enter it like this domain.com I get the 'It works!' page. I'm a complete Apache newb so I'm not exactly sure ...
2
votes
5answers
4k views

Why is PHP script downloaded instead of executed

I have a local LAMP server set up on my Ubuntu laptop for testing various PHP scripts. Sometimes, when I do something wrong, instead of getting an error, the script I'm testing is offered for ...
1
vote
3answers
2k views

Disable access logging for domains. (Using CentOS & Apache)

I am trying to disable access logging for domains on my dedicated server for over 10 HOURS. I read over 70 pages while I'm searching. I asked on Parallel's forum, I asked stackoverflow in another ...
5
votes
4answers
3k views

Apache virtual host based on *source* IP

Is it possible to configure Apache for different virtual hosts based on the source IP? (i.e. same interface, same hostname, but two different virtual hosts, with different content, based on source ...
1
vote
1answer
87 views

Creating new users using PHP not recognized by Apache 2.4

I have a server setup where new linux users are created using (PHP) shell_exec ( '/usr/sbin/useradd ' . $username ); exec ('usermod -a -G ' . $username . ' '. $username); #add user into the usergroup ...
1
vote
1answer
443 views

TOR: hide my site in clearweb‏

I have launched a website in TOR and I can access it through the .onion address and also typing the ip of my server in my browser. I want my site was only accessible from TOR and not through ...
0
votes
2answers
591 views

ec2, ping and security settings

Got a noob question about security settings on AWS ec2 instance. I've set up an instance with Tocat7 ( ami-95da17fc ) and I have a little issue. If I ssh into the instance and do ping -c 2 -p 80 ...
27
votes
9answers
27k 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, ...
16
votes
4answers
12k views

How can I determine the cause of an apparent memory leak in my Apache/PHP based web app?

About once a week, but sometimes even a couple of times a day after running fine for days, my EC2 instances become unresponsive. Munin's memory graphs tell a pretty straightforward story: memory ...
33
votes
5answers
33k 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 ...
13
votes
7answers
44k views

Apache VirtualHost with mod-proxy and SSL

I am trying to setup a server with multiple web applications which will all be served through apache VirtualHost (apache running on the same server). My main constrain is that each web application ...
25
votes
15answers
50k 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. ...
11
votes
3answers
1k views

The A to Z of setting up a Linux box for secure local hosting

I am in the process of reinstalling the OS on a machine that will be used to host a couple of applications for our business. The applications will be local only; access from external clients will be ...
29
votes
4answers
37k 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 ...
22
votes
7answers
32k 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 ...
30
votes
5answers
45k 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 ...