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)

162
votes
5answers
33k views

Redirect, Change URLs or Redirect HTTP to HTTPS in Apache - Everything You Ever Wanted 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 ...
117
votes
4answers
106k 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/. ...
16
votes
3answers
3k views

Why not use a WAMP stack?

I recently had a talk with some experienced people and they suggested to me not to use a WAMP stack, and instead install apache, mysql and php separately. I don't understand why they have suggested ...
76
votes
5answers
46k 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 ...
158
votes
3answers
109k 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 ...
3
votes
3answers
9k 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 ...
103
votes
2answers
42k 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 ...
20
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)
21
votes
2answers
6k 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 ...
2
votes
1answer
62 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 ...
55
votes
8answers
113k 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 ...
18
votes
4answers
25k 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 ...
11
votes
3answers
2k 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 ...
28
votes
6answers
38k 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 ...
4
votes
1answer
3k 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 ~* ...
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 ...
20
votes
3answers
39k 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 ...
6
votes
2answers
24k 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
9k 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 ...
5
votes
1answer
555 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 ...
10
votes
2answers
633 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. ...
5
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 ...
2
votes
5answers
5k 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 ...
0
votes
1answer
102 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 ...
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 ...
2
votes
1answer
2k 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. ...
22
votes
11answers
43k 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 ...
14
votes
5answers
7k views

mod_security block requests by http-host header

The last few days I noticed some servers being hammered with unknown requests. Most of them are like the following: 60.246.*.* - - [03/Jan/2015:20:59:16 +0200] "GET ...
1
vote
3answers
3k 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 ...
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?
1
vote
1answer
144 views

Understand ssl setup

Goals: If the user support SNI and hit myurl1.server.com (https) or myurl2.server.com (https) it will match the right vhost. (the last 2 vhosts) If the user does not support SNI and hit ...
44
votes
12answers
58k views

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

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 ...
28
votes
6answers
18k 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 ...
19
votes
3answers
21k views

stop apache from asking for SSL password each restart [duplicate]

Using instructions from this site but varying them just a little i created a CA using -newca, i copied cacert.pem to my comp and imported as trusted issuer in IE. I then did -newreq and -sign (note: i ...
9
votes
8answers
32k 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 ...
9
votes
4answers
17k 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 ...
5
votes
3answers
5k 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. ...
4
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 ...
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 ...
1
vote
2answers
261 views

Stop default SSL response on Shared IP using SNI

Previously I asked a question here: Single domain SSL presented for all domains on Shared IP about setting up secure and non-secure domains on a single IP. Opinions were mixed, but it appears SNI ...
5
votes
4answers
5k 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 ...
2
votes
1answer
379 views

Weird http -> https redirection although not configured

I am running Apache 2.2.15 (CentOS 6.6) with a HTTP-only domain demo.xml-director.info Using wget I can retrieve the content properly wget -S http://demo.xml-director.info --2015-01-05 13:31:41-- ...
1
vote
1answer
185 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
621 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
715 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 ...
29
votes
9answers
30k 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, ...
37
votes
4answers
100k 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 ...
16
votes
4answers
15k 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 ...