1,主配置文件模板 # cat httpd.conf ServerRoot "/usr/local/apache" Listen 80 LoadModule authn_file_module modules/mod_authn_file.so LoadModule authn_core_module modules/mod_authn_core.so LoadModule authz_host_module modules/mod_authz_host.so LoadModule authz_groupfile_module modules/mod_authz_groupfile.so LoadModule authz_user_module modules/mod_authz_user.so LoadModule authz_core_module modules/mod_authz_core.so LoadModule access_compat_module modules/mod_access_compat.so LoadModule auth_basic_module modules/mod_auth_basic.so LoadModule reqtimeout_module modules/mod_reqtimeout.so LoadModule filter_module modules/mod_filter.so LoadModule mime_module modules/mod_mime.so LoadModule log_config_module modules/mod_log_config.so LoadModule env_module modules/mod_env.so LoadModule headers_module modules/mod_headers.so LoadModule setenvif_module modules/mod_setenvif.so LoadModule version_module modules/mod_version.so LoadModule unixd_module modules/mod_unixd.so LoadModule status_module modules/mod_status.so LoadModule autoindex_module modules/mod_autoindex.so LoadModule negotiation_module modules/mod_negotiation.so LoadModule dir_module modules/mod_dir.so LoadModule alias_module modules/mod_alias.so LoadModule rewrite_module modules/mod_rewrite.so LoadModule php5_module modules/libphp5.so AddType application/x-httpd-php .php .php5 AddType application/x-httpd-php-source .phps <IfModule unixd_module> User www Group www </IfModule> ServerAdmin you@example.com ServerName localhost <Directory /> AllowOverride none Require all denied </Directory> DocumentRoot "/usr/local/apache/htdocs" <Directory "/usr/local/apache/htdocs"> Options FollowSymLinks AllowOverride None Rquire all granted </Directory> <IfModule dir_module> DirectoryIndex index.php index.html </IfModule> <Files ".ht*"> Require all denied </Files> ErrorLog "logs/error_log" LogLevel warn <IfModule log_config_module> LogFormat "%h %a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%h %a %l %u %t \"%r\" %>s %b" common <IfModule logio_module> LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio </IfModule> CustomLog "logs/access_log" common </IfModule> <IfModule alias_module> ScriptAlias /cgi-bin/ "/usr/local/apache/cgi-bin/" </IfModule> <IfModule cgid_module> # # ScriptSock: On threaded servers, designate the path to the UNIX # socket used to communicate with the CGI daemon of mod_cgid. # #Scriptsock cgisock </IfModule> <Directory "/usr/local/apache/cgi-bin"> AllowOverride None Options None Require all granted </Directory> <IfModule mime_module> TypesConfig conf/mime.types AddType application/x-compress .Z AddType application/x-gzip .gz .tgz </IfModule> Include conf/extra/httpd-mpm.conf Include conf/extra/httpd-multilang-errordoc.conf Include conf/vhosts/*.conf Include conf/extra/httpd-default.conf <IfModule proxy_html_module> Include conf/extra/proxy-html.conf </IfModule> <IfModule ssl_module> SSLRandomSeed startup builtin SSLRandomSeed connect builtin </IfModule> LoadModule remoteip_module modules/mod_remoteip.so RemoteIPHeader X-Forwarded-For RemoteIPInternalProxy 127.0.0.1 1.1.1.1 2.2.2 <Files ~ "\.tar|\.bz2|\.svn|\*.gz"> Require all denied </Files> <DirectoryMatch .*\.svn/.*> Require all denied </DirectoryMatch> 2,默认配置文件模板 # cat defaults.conf #2.4 <VirtualHost *:80> ServerAdmin root@myself.com DocumentRoot /usr/local/apache/htdocs/ <Directory "/usr/local/apache/htdocs/" > Options FollowSymLinks AllowOverride None Require all denied </Directory> </VirtualHost> 3,禁止ip访问模板 # cat 1.1.1.1.conf <VirtualHost *:80> ServerAdmin root@myself.com ServerName 1.1.1.1 ServerAlias 2.2.2.2 DocumentRoot /usr/local/apache/htdocs/ <Directory "/usr/local/apache/htdocs/" > Options FollowSymLinks AllowOverride None Require all denied </Directory> </VirtualHost> 4,虚拟主机配置文件模板 # cat www.test.com.conf #www.test.com <VirtualHost *:80> ServerAdmin admin@test.com DocumentRoot /data/web_root/www.test.com/www ServerName www.test.com ServerAlias iwww.test.com ErrorLog "/data/logs/apache/www.test.com-error_log" CustomLog "|/usr/local/apache/bin/rotatelogs /data/logs/apache/www.test.com-access_log_%Y%m%d.log 86400 480" combined RewriteEngine On <Directory "/data/web_root/www.test.com/www"> Options FollowSymLinks AllowOverride all Require all granted </Directory> </VirtualHost>
4----apache主配置文件模板和基于域名虚拟主机配置文件模板
原创
©著作权归作者所有:来自51CTO博客作者wpf926的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
Nginx(二)配置文件及域名虚拟主机
Nginx的配置文件nginx.conf1.全局配置#user nobody; //运行用户worker_proccesses; &nb
server 虚拟主机 配置文件 events nobody -
Nginx的虚拟主机配置文件
server { listen 80; server_name www.aldjflas.cn; access_log &nb
server 虚拟主机 配置文件 listen -
Nginx(二)-- 配置文件之虚拟主机配置
1.配置文件与解释 2.Nginx虚拟主机配置 1.基于域名配置(使用的比较多) 1) 在nginx/con
Nginx 配置文件 虚拟主机配置 html nginx -
虚拟主机配置python 虚拟主机配置文件路径
一、虚拟机配置文件 每个KVM虚拟主机都有自己的配置文件,都是以虚拟主机名命名;KVM虚拟机的配置文件在/etc/libvirt/qemu/下,以xml文件形式存在;
虚拟主机配置python 配置文件 xml 虚拟主机