
VirtualHost / Basic Auth / Alias / Log / log rotate / Rewrit
Snippet options
Download: Download snippet as virtualhost-basic-auth-alias-log-log-rotate-rewrit.txt.
Copy snippet: For this you need a free my code stock.com account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!
NameVirtualHost * <VirtualHost *:80> ServerName server.name.for.virtal.host DocumentRoot "/path/to/document/root" <Directory "/path/to/document/root"> AllowOverride All Options ExecCGI Order allow,deny Allow from all </Directory> <FilesMatch "^[\._]ht"> Order allow,deny Deny from all Satisfy All </FilesMatch> <Directory "/path/to/document/root/need/auth"> AllowOverride All Order allow,deny Allow from all AuthType Basic AuthName "Enter user name and passwd" AuthUserFile /path/to/htpassword AuthGroupFile /dev/null Require valid-user </Directory> # need mod_alias Alias /aliased "/path/to/alias" <Directry "/path/to/alias"> AllowOverride All Order allow,deny Allow from all </Directory> #need mod_rewrite RewriteEngine On RewriteRule ^source_patern$ dest_pattern [L,R] RewriteRule ^/favicon.ico$ /static/images/favicon.ico [L,R] RewriteCond %{HTTP_USER_AGENT} ^.*(Docomo|KDDI|UP.Browser|J-Phone|Vodafone|SoftBank|iPhone|iPod).*$ RewriteRule ^/$ /mobile/ [L,R] # mod_python and django # LoadModule python_module modules/mod_python.so <Location "/app"> SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE application.settings SetEnv PYTHONIOENCODING UTF-8 SetEnv PYTHON_EGG_CACHE /tmp/python-egg-cache PythonOption django.root /app PythonPath "['/path/to/django/apps','/path/to/libraries'] + sys.path" </Location> # mod_wsgi and django # LoadModule wsgi_module modules/mod_wsgi.so WSGIScriptAlias /app /path/to/wsgi/file.wsgi <Directory /path/to/wsgi> Order deny,allow Allow from all </Directory> # for django admin Alias /media /path/to/python/site-packages/django/contrib/admin/media <Directory /path/to/python/site-packages/django/contrib/admin/media> Order allow,deny Allow from all </Directory> # mod_php PHP # LoadModule php5_module /path/to/module # AddType application/x-httpd-php .php <IfModule dir_module> DirectoryIndex index.php index.html </IfModule> PHPINIDir /path/to/phpini/parent/ Alias /path/to/phpapp/root/ <Directory /path/to/phpapp/root> Order allow,deny Allow from all Options ExecCGI </Directory> # proxypass (for tomcat6 ajp) FIXME: include conf/httpd-tomcat.conf <Location /proxied> ProxyPass /proxied ajp://localhost:8009/proxied </Location> # for static files <LocationMatch "\.(jpg|gif|png)$"> SetHandler None </LocationMatch> # errors ErrorDocument 401 /error/401.html ErrorDocument 403 /error/403.html ErrorDocument 404 /error/404.html ErrorDocument 405 /error/405.html ErrorDocument 500 /error/500.html ErrorDocument 503 /error/503.html ErrorLog logs/server_name/error_log TransferLog logs/server_name/access_log CustomLog "|/usr/sbin/rotatelogs /log/to/host/access_log.%Y-%m-%d 86400 540" combined </VirtualHost>
Create a free my code stock.com account now.
my code stok.com is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!
Find out more and register nowYou can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.