22 votes

Load time impact of htaccess

The recommendation from the Apache project is: In general, you should only use .htaccess files when you don't have access to the main server configuration file. ... a common misconception is that ...
  • 73.4k
10 votes

Apache2 Proxy timeout

I wanted to point out that although this answer works great for older versions, it breaks under recent versions of Apache 2.4 with error code AH00526. ProxyPass and ProxyPassMatch or <Proxy> and ...
10 votes

How to disable the default document root in Apache?

Thanks for the other answers. I solved it by adding a default virtual host without any permissions. The global DocumentRoot and ServerName options must match the ones specified in the virtual host. /...
  • 393
10 votes
Accepted

How can I see the httpd log for outbound connections?

Modifying third-party PHP application may not be a feasible solution. HTTP proxy should be used, for at least two reasons: Every time any of the PHP scripts attempts to access an external resource it ...
8 votes
Accepted

How can I block a user agent from all sites on my server?

Looks like an old question now, but I wanted to do the same and found the answer from nerve above. It's not quite right as is - seems to me that it should be <Location "/">, and the SetEnvIf ...
8 votes

How to disable the default document root in Apache?

Yes and No. You can comment out or remove the DocumentRoot directive, no problem. But that doesn't achieve much, because then it will default to the default directory PREFIX/htdocs/ where PREFIX is ...
  • 73.4k
8 votes
Accepted

OpenBSD: How to use `relayd` and `httpd` for redirecting subdomain requests

concerning relayd I guess something like would achieve what you want : This defines the ip where you can find the foo "service" it's a list of host basically (pf style) table <fooservice> { ...
7 votes

Apache2 Proxy timeout

I have Apache 2.4.6, but the patch to fix it is provided in Apache >= 2.4.8. The key here is to start your output immediately so that Apache (mod_proxy_fcgi) thinks the connection is active. For ...
  • 71
7 votes
Accepted

Can't restart httpd.service on CentOS 7 (Apache server)

Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service and "journalctl -xe" for details. (empahsis mine) How do I solve this error? ...
  • 115k
7 votes
Accepted

Apache Conditional Redirect HTTP to HTTPS

But now my certificate seems to need HTTP. This is not quite correct. I am personally renewing over https. In order for that to work however, you need make sure to allow access to the challenge URI ...
  • 156
6 votes
Accepted

Apache - separate log files for each auto subdomain

You cannot use variables in log location directives. The way to do it is to pipe the log to another program. Here is a possible solution: https://stackoverflow.com/questions/20217533/dynamic-apache-...
  • 396
6 votes

apache multiviews, how to disable it

In case of Options either you have to use * or - sign with all or with none; i.e. Options FollowSymLinks -MultiViews -Indexes is wrong. If you are using + or - sign, you have to use for all options ...
  • 61
6 votes

Do I have 2 different Apache installations on my VPS

Yes - they are reporting different version numbers hence are different instances of Apache. /usr/local/apache2 is the default base directory for a apache compiled from source, while the other one ...
  • 20k
6 votes

Can I view the resolved config Apache is using?

Yes, to a certain degree, but I think it covers your requirement. You can use mod_info for this. From the online documentation (emphasis mine): Dumping the configuration on startup If the ...
  • 15k
6 votes

Apache Virtual Hosts Override httpd.conf

Every Directive lists the context in which it is valid. In other words where it is allowed to be used. The context can be any combination of: s - server config This means that the directive may be ...
  • 73.4k
6 votes
Accepted

Apache (Linux) httpd listen on link-local IPv6 address

Having spent some time on this it seems that the Apache documentation could be misleading, although I may have missed something. It says IPv6 addresses must be enclosed in square brackets. This is ...
  • 1,664
6 votes

How to impose two conditions at once for Apache CustomLog?

The reqenv function must be compared against something, you cannot just check for the environment variable to be set or not as your code tries to. I admit the error message is not particularly ...
  • 2,316
6 votes

Is it correct to define two listen (80 and 443) under same nginx server?

It is allowed to listen on multiple ports on the same server block, but it depends on your objective if you want to do it. Personally I use the following setup when I have the following set of ...
5 votes

How to find out which httpd.conf apache is using at runtime

As of 2016 (Bug 59376), from Apache 2.4.23 onwards, an option dedicated to this purpose is available. It can display the entire config file tree, including line numbers, which is useful to debug ...
5 votes
Accepted

Do I have 2 different Apache installations on my VPS

Yes, you have two Apache installations on your VPS. You have Apache installed from the ubuntu repositories, installed in /usr You have Apache installed from source installed in /usr/local/apache2 ...
5 votes

How to disable the default document root in Apache?

I'm not sure you want to do that. If there is no default vhost in an apache config, the first defined vhost becomes the default. All you really need to do is have the default serve a blank page.
  • 115k
5 votes
Accepted

What modules can be enable/disable in a default Apache 2.4 setup?

It really depends on exactly what you are doing and what configuration directives you are using. If you want to start with an absolute minimal configuration and then build up from there, there is an ...
  • 2,316
5 votes
Accepted

Catch-All HTTPS Vhost on Apache 2.4

The problem was solved but there was some misunderstandings. There really is the requirement that HTTPS needs a matching certificate, but the problem caused by this is that the connection won't be ...
  • 44.5k
5 votes

Apache doesn't log remoteIP when RemoteIPHeader X-Forwarded-For is present

Proxy Layer (Nginx) proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; Backend Layer (Apache) # Log format config LogFormat "%{...
  • 51
5 votes
Accepted

Apache doesn't log remoteIP when RemoteIPHeader X-Forwarded-For is present

Restore %a to that format if you're going to use mod_remoteip. In bugzilla, mod_remoteip fills in %a while it removes from %{X-Forwarded-For}i. So in a simple case with one trusted proxy, %a will ...
  • 131
5 votes

How can I see the httpd log for outbound connections?

There isn't any solution that can be just switched on, but this functionality has to be implemented. One possible approach is: Make a wrapper around the functions that make outgoing requests: function ...
4 votes
Accepted

Does a wildcard subdomain (*.example.com) in Apache config also include the root (example.com)?

No, *.example.com does not match example.com. You're missing at least a dot, see? Right before "example". Edit: Apache documentation backing this up. In fact, they specifically advise using ...
  • 15.5k
4 votes
Accepted

Setting up a multi-domain apache with nameservers, but every request is handled by the default configuration

I found the problem, in case anyone else ends up with a similar scenario: <VirtualHost 127.0.0.2:80> I had to change this to the actual server's IP because, for some reason, Virtualmin didn't ...
  • 161
4 votes

How can I tell which config file Apache is using?

Because some configs use Server app, brew or whatever, and because one liners FTW : $(ps ax -o comm | grep -m 1 httpd) -V | grep SERVER_CONFIG_FILE This command do the following : Find an active ...
  • 141
4 votes
Accepted

Settings in httpd.conf not working

Your apache2.conf file does not include the additional locations you're trying to configure by default. If you would like these config files to be used, you should add include lines for them in ...

Only top scored, non community-wiki answers of a minimum length are eligible