Tag Info

Hot answers tagged

40

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 ...


23

With any *nix application, the easiest method is to query the binary itself. In the case of httpd, I'd imagine the process would be something like this: $ whereis httpd /usr/sbin/httpd $ /usr/sbin/httpd -V Server version: Apache/2.2.11 (Unix) Server built: Jun 17 2009 14:55:13 Server's Module Magic Number: 20051115:21 Server loaded: APR 1.2.7, APR-Util ...


21

The easiest way to do this is through the Listen directive. By defaults, there's a line in our httpd.conf that reads: Listen *:80 Meaning it will respond ro requests on port 80 on all of your computer's network addresses. Changing it to: Listen 127.0.0.1:80 Will tell apache only to only respond to requests on the local adaptor, thus ignoring anything ...


20

apache2ctl -V | grep SERVER_CONFIG_FILE


18

You can use Include directive in httpd.conf to be able to maintain redirects in another file. But it would not be very efficient, as every request would need to be checked against a lot of regular expressions. Also a server restart would be required after every change in the file. A better way for so many redirects would be to use RewriteMap directive of ...


17

Yes. conf.d files are included in Apache's configuration with a line like: Include conf.d/*.conf so changes are only noticed when the main configuration is reloaded. Note you can also use the 'graceful' restart (/etc/init.d/httpd graceful on some, apachectl graceful on others) to reload the configuration without dropping existing connections.


14

You should be able to do this using something like: server { server_name example.com; client_max_body_size 10m; # or whatever size limit you want error_page 413 /custompage.html; # you can also use a named location here if you like } http://wiki.nginx.org/HttpCoreModule#client_max_body_size http://wiki.nginx.org/HttpCoreModule#error_page


13

mod_info provides what you need, I think. <Location /server-info> SetHandler server-info Order deny,allow Deny from all Allow from 1.2.3.4 # your IP, subnet, whatever </Location> More here: http://httpd.apache.org/docs/2.2/mod/mod_info.html You can also list the configuration of your VirtualHosts (less info than using the above) ...


12

Information on apache httpd.conf files can be found at here. Some snippets have been copied from this website to ensure that the information is not lost if the link would deprecated: Include /usr/local/apache2/conf/ssl.conf Include /usr/local/apache2/conf/vhosts/*.conf Relative paths: Include conf/ssl.conf Include conf/vhosts/*.conf Wildcards: ...


11

The listen option is probably best, but just as an FYI, you can do it using allow/deny like this <Directory /www/vhosts/localhost/> Options All AllowOverride All Order deny,allow Deny from all Allow from 127.0.0.1 </Directory> Order deny,allow tells Apache to "Deny all requests unless specifically allowed" (Order allow,deny ...


10

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. <Proxy fcgi://127.0.0.1:49158> ProxySet timeout=1800 </Proxy> ProxyPassMatch ^/(.+\.php.*)$ fcgi://127.0.0.1:49158/home/...<your_path> I needed to add ...


9

Directory directive works only for filesystem objects (e.g. /var/www/mypage, C:\www\mypage), while Location directive works only for URLs (the part after your site domain name, e.g. www.mypage.com/mylocation). The usage is straightforward - you would use Location if you need to fine tune access rights by an URL, and you would use Directory if you need to ...


8

You are basically correct, however missing a subtlety in the use of Options. First, however, don't just stick them in the NameVirtualHost container, use a Directory Statement... You are correct that the most specific ones apply, however, if an options statement contains a list of options where every one is prefixed with a + or -, then the options are ...


8

In a typical environment, you can create a copy of httpd.conf and then modify the following properties on the new file. # pid file PidFile run/httpd.pid # http listen port Listen 80 # log files ErrorLog logs/error_log CustomLog logs/access_log combined # server name ServerName default_host_name # document root for the default site DocumentRoot ...


8

Use mod_rewrite, something like this: RewriteEngine On RewriteCond %{HTTP_HOST} !^www.example.org [nocase] RewriteRule ^(.*)$ http://www.example.org$1 [last,redirect=301]


7

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


7

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 ...


6

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 ...


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: http://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

Try ps ax | grep httpd and you should (might) get output like 1633 ?? Ss 0:00.21 /usr/sbin/httpd -f /etc/httpd.conf Additionally, how exactly are you restarting the server? Just curious in case you somehow aren't actually re-reading the config file.


5

Check iptables rules: iptables -nv -L To add new rules, edit /etc/sysconfig/iptables: ... -A RH-Firewall-1-INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT ... To restart iptables: #service iptables restart To stop iptables: #service iptables stop For debug use ...


5

The Apache manual section on mod_authz_host is instructive here. The order of your allow and deny statements does not matter. With order allow,deny, you must match at least one allow and no deny directives for your request to be accepted. I think you want order deny,allow.


5

You're running out of swap because you're using all your RAM and then some. You have a serious problem that you need to rectify right now. You have two choices: ignore cause and just add more RAM, or target the problem of what's actually munching on your memory. Adding RAM is fairly cheap and fairly easy if it's your server but it's a temporary fix and if ...


5

There are a few little details to get this working on Windows, but I've managed to do so with the following configuration: SetEnv GIT_PROJECT_ROOT d:/Export/GIT/ SetEnv GIT_HTTP_EXPORT_ALL ScriptAlias /git/ "C:/Progra~1/Git/libexec/git-core/git-http-backend.exe/" <Directory "C:/Program Files/Git/libexec/git-core/"> Options +ExecCGI Allow From All ...


5

Yes, they are equivalent in the aspect of both providing the same result, only allowing access from 127.0.0.1. Let me quote the relevant part from the documentation on the Order directive. Allow,Deny First, all Allow directives are evaluated; at least one must match, or the request is rejected. Next, all Deny directives are evaluated. If any ...


5

In Apache 2.x you don't need to modify source code for increasing maximum clients above 255 like in Apache 1.3 you had to. Instead just tune your httpd.conf. Put there in prefork configuration section ServerLimit 1024 MaxClients 1024 And you should be all set.


5

You can do it with Include directive: Include /path/to/virtual_hosts.conf


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 ...


5

Use Listen IP1:80 and it will only bind to that IP. http://httpd.apache.org/docs/2.2/bind.html When Apache starts, it binds to some port and address on the local machine and waits for incoming requests. By default, it listens to all addresses on the machine. However, it may need to be told to listen on specific ports, or only on selected ...



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