90

Almost there! Add this to ports.conf or http.conf and keep your above config. <IfModule mod_ssl.c> # If you add NameVirtualHost *:443 here, you will also have to change # the VirtualHost statement in /etc/apache2/sites-available/default-ssl # to <VirtualHost *:443> # Server Name Indication for SSL named virtual hosts is ...


48

Solution is on Apache 2.2 documentation on the Virtualhost directive: Syntax: ... (...) Addr can be: The IP address of the virtual host; A fully qualified domain name for the IP address of the virtual host (not recommended); The character *, which is used only in combination with NameVirtualHost * to match all IP addresses; or The ...


33

I finally fixed this problem after testing several configuration parameters. I tested the solution twice, removing all previous changes. Only one parameter was needed for me to fix it. For the latest versions of httpd and mod_proxy_fcgi you can simply add timeout= to the end of the ProxyPassMatch line, e.g.: ProxyPassMatch ^/(.+\.php.*)$ fcgi://127.0.0.1:...


22

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 user authentication and mod_rewrite directives must go in .htaccess files. So please both set AllowOverride None and all your other directives in the main httpd....


19

There's another serverfault question regarding this. If you're using a debian based server you can use apache2ctl to determine which config file is being used: apache2ctl -V More on this: How to find out which httpd.conf apache is using at runtime


12

You just need to change your Listen directives to: Listen [::]:80 Listen [::]:443 while your NameVirtualHost *:80 <VirtualHost *:80> remain the same. Note: netstat -tln will show apache listening only on tcp6 / :::80; that is normal (it will also respond to IPv4 as before)


11

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. /etc/httpd/conf/httpd.conf ... ServerName <server-ip>:80 DocumentRoot "/var/www/html" <Directory /> Order Deny,Allow Deny from all ...


10

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 <ProxyMatch> cannot be used together within the same worker name. This used to function just fine, so don't know if that was changed by design or if it's ...


8

I ran into the same exact issue. SecRequestBodyNoFilesLimit was the reason. it was not used in my config at all, but it does have a default value, 1048576. Once I found that this setting existed, I set it larger than my files and everything is working. Here is the documentation https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#wiki-...


8

try mod_macro Here is an example: ## Define a VHost Macro for repetitive configurations <Macro VHost $host $port $dir> Listen $port <VirtualHost *:$port> ServerName $host DocumentRoot $dir # Public document root <Directory $dir> Require all granted </Directory> # limit access to intranet subdir. &...


8

I think you need to wrap your existing it.example.com definition in a <VirtualHost> block. I think this is being caused because without the vhost definition for it.example.com, kb.example.com becomes the default vhost. In the event that a suitable vhost isn't found this is what will be served which then comes back to itself ...


8

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> { 192.168.30.3 } table <barservice> { 192.168.30.4 } Here you define a template for the rules to apply in a relay section you match the request with the ...


7

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 needs a regular expression so the parentheses need to be quoted. This worked for me to apply the access control across all vhosts: SetEnvIfNoCase User-Agent "^...


7

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 set when you build apache. When you have VirtualHosts set up all requests that are not handled by an explicitly configured virtual host get handled by the ...


7

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? Read the error message carefully, note that it provides useful information on what to do to gather more information, specifically it mentions 2 commands that you ...


6

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 example, I am using PHP and the DB query for my AJAX call takes > 30 seconds. Because I know that the overall response will be "Content-Type: application/json", I ...


6

a2enmod [enter] -> see all available modules apache2ctl -M -> see loaded modules (can be apachectl on RedHat)


6

Because you've got a comma before Limit. That makes apache parse it as though it were part of Options rather than a separate override. Think of it like this: AllowOverride AuthConfig FileInfo Options=Indexes,Limit What you want is instead AllowOverride AuthConfig FileInfo Limit Options=Indexes There's more ...


6

You could use the Require directive: <Directory "/var/www/folder"> <Files "index.php"> Require method POST </Files> </Directory> However, since that's part of the authorization section, you may want to try this instead: <Directory "/var/www/folder"> <Files "index.php"> <LimitExcept POST>...


6

By default, in CentOS, there is a file used by Apache/httpd located at /etc/httpd/conf.d/ssl.conf. This file is read in as a configuration by Apache along with the "httpd.conf" file and anything in it takes precedence over settings in httpd.conf. That file (again by default) contains a Listen 443 directive. You cannot call that directive twice (as it will ...


6

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-log-directory-based-on-hostname


6

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 with files in /usr/sbin and /etc is the Ubuntu distributed version. Unless you have a very specific reason for doing otherwise it is best practice to stick with ...


6

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 config define -DDUMP_CONFIG is set, mod_info will dump the pre-parsed configuration to stdout during server startup. Pre-parsed means that directives like <...


6

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.


6

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 used in the server configuration files (e.g., httpd.conf), but not within any <VirtualHost> or <Directory> containers. It is not allowed in ....


6

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 true for non link-local addresses. But I have now discovered that link-local addresses can be used, and must include a scope id, but without the square brackets. ...


6

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 enlightening :-) The following should work for you: SetEnvIf Request_URI ^/(img|js|css|thumb|banner) static=yes SetEnvIf Remote_Addr "127.0.0.1" dontlog=yes ...


5

On Ubuntu the main configuration file is /etc/apache2/apache2.conf However it's also split out into different files that can be found in /etc/apache2/conf.d /etc/apache2/sites-enabled /etc/apache2/mods-enabled There are also /etc/apache2/sites-available /etc/apache2/mods-available You should probably spend some time reading the documentation to get an ...


5

I can think of three ways to achieve this. Within a directory, virtualhost or .htaccess context, you can use RemoveType .com to remove the mapping. I'm not certain whether it will work within a proxy context as that's not an actual directory. But if it doesn't, you could go the opposite route of removing .com from the general list, and then specifically ...


5

Does that mean that RewriteEngineOn can be used multiple times within httpd.conf? Yes, that's fine. I'm assuming that it can be but it must be placed within directory blocks. No, it's valid in any configuration context, and will inherit down to other contexts - so if you have it enabled at the <VirtualHost>, you don't need it within <Directory&...


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