注意其中对虚拟主机是如何设置的,是Apache2的写法,比较规范。
还有PHP限定到目录,安全模式的开启。
httpd.conf
ThreadsPerChild 500
MaxRequestsPerChild 10000
ServerRoot "D:/AndyServer/Apache"
Listen 80
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule imagemap_module modules/mod_imagemap.so
LoadModule include_module modules/mod_include.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule ssl_module modules/mod_ssl.so
LoadFile "D:/AndyServer/PHP/libmysql.dll"
LoadModule php5_module "D:/AndyServer/PHP/php5apache2_2.dll"
PHPIniDir "D:/AndyServer/PHP/php.ini"
ServerAdmin webmaster@localhost
ServerName 127.0.0.1:80
DocumentRoot "D:/AndyServer/www/htdocs"
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Satisfy all
</Directory>
<Directory "D:/AndyServer/www/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<IfModule dir_module>
DirectoryIndex index.html index.htm default.htm index.php default.php index.cgi default.cgi index.pl default.pl index.shtml default.shtml
</IfModule>
<FilesMatch "^\.ht">
Order allow,deny
Deny from all
</FilesMatch>
ErrorLog logs/error.log
LogLevel warn
<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %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>
</IfModule>
<IfModule alias_module>
ScriptAlias /cgi-bin/ "D:/AndyServer/www/cgi-bin/"
</IfModule>
<Directory "D:/AndyServer/www/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
DefaultType text/plain
<IfModule mime_module>
TypesConfig conf/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddHandler cgi-script .cgi
AddHandler cgi-script .pl
</IfModule>
Include conf/extra/httpd-mpm.conf
Include conf/extra/httpd-multilang-errordoc.conf
Include conf/extra/httpd-autoindex.conf
Include conf/extra/httpd-languages.conf
Include conf/extra/httpd-vhosts.conf
Include conf/extra/httpd-default.conf
Include conf/extra/httpd-ssl.conf
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
NameVirtualHost *:80
<VirtualHost *:80>
ServerName *
DocumentRoot "D:/AndyServer/www/htdocs"
</VirtualHost>
<Directory "D:/AndyServer/www/htdocs">
Options FollowSymLinks IncludesNOEXEC Indexes
DirectoryIndex index.html index.htm default.htm index.php default.php index.cgi default.cgi index.pl default.pl index.shtml
AllowOverride None
Order Deny,Allow
Allow from all
</Directory>
Alias /phpmyadmin "D:/AndyServer/www/phpMyAdmin"
<Directory "D:/AndyServer/www/phpMyAdmin">
AllowOverride None
Options Indexes FollowSymLinks Includes
Order allow,deny
Allow from all
</Directory>
Alias /sqlitemanager "D:/AndyServer/www/SQLiteManager"
<Directory "D:/AndyServer/www/SQLiteManager">
AuthUserFile "D:/AndyServer/SQLiteManPwd.ini"
AuthType Basic
AuthName "SQLiteManager管理员登录"
require valid-user
AllowOverride None
Options Indexes FollowSymLinks Includes
Order allow,deny
Allow from all
</Directory>
ProxyPass /asp
http://127.0.0.1:10322
ProxyPassReverse /asp/
http://127.0.0.1:10322/
Include conf/apmserv/vhost.conf
Include conf/apmserv/vhost_ssl.conf
Include conf/apmserv/vdir.conf
vhost.conf
<VirtualHost *:80>
ServerName test.com
ServerAlias
www.test.com
DocumentRoot "D:/AndyServer/www/htdocs/test"
</VirtualHost>
<Directory "D:/AndyServer/www/htdocs/test">
Options IncludesNOEXEC
DirectoryIndex index.html index.htm default.htm index.php default.php index.cgi default.cgi index.shtml index.aspx default.aspx
AllowOverride None
Order Deny,Allow
Allow from all
php_admin_value open_basedir "D:/AndyServer/www/htdocs/test/;D:/AndyServer/PHP/uploadtemp/;D:/AndyServer/PHP/sessiondata/"
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
php_admin_value safe_mode On
</Directory>
APMserv中的my.ini很干净,只有几行代码,注释全干掉了。
内存1G的优化:
[mysqld]
basedir=D:/AndyServer/MySQL5.0
datadir=D:/AndyServer/MySQL5.0/data
port=3306
key_buffer=256M
max_allowed_packet=2M
table_cache=512
thread_cache=32
join_buffer_size=16M
sort_buffer=16M
record_buffer=16M
max_connections=500
wait_timeout=120
interactive_timeout=120
max_connect_errors=30000
long_query_time=1
max_heap_table_size=128M
tmp_table_size=64M
thread_concurrency=8
myisam_sort_buffer_size=64M
内存2G的优化:
[mysqld]
basedir=D:/AndyServer/MySQL5.0
datadir=D:/AndyServer/MySQL5.0/data
port=3306
key_buffer=384M
max_allowed_packet=4M
table_cache=1024
thread_cache=64
join_buffer_size=32M
sort_buffer=32M
record_buffer=32M
max_connections=500
wait_timeout=120
interactive_timeout=120
max_connect_errors=30000
long_query_time=1
max_heap_table_size=256M
tmp_table_size=128M
thread_concurrency=8
myisam_sort_buffer_size=128M