实践
apache 几个比较重要的操作--------------------------------------------------
apache2 graceful graceful-stop configtest
-------------------------------用户目录
userdir
http://wenku.it168.com/d_000400248.shtml
1 看是否加载 userdir.c模块 (查看loadmodule )
2 默认配置为disable
<IfModule>
UserDir disable 改为 UserDir public_html
</IfModule>
3 restart httpd
此时访问为forbidden
4 修改权限
chmod 755 -R ggh/
chmod 755 -R ggh/public_html
浏览网页正常。
--------------------------虚拟主机
<VirtualHost *>
ServerName
www.kernel.com
DocumentRoot /byh/we5-1/
</VirtualHost>
注意
UseCanonicalNames to Off
-------------------------脚本支持--------
1 对perl 支持
Apache to run Perl scripts directly, rather
than relying on the normal CGI tools to do so. You may need to install a package called
apache - mod_perl , libapache2 - mod - perl2
2
LoadModule perl_module /usr/lib/apache2/modules/mod_perl.so
---------------------启动封装------------
三步
1 安装特殊版本 或者安装插件
www.apache-ssl.org yum install mod-ssl -y
2 获得证书 (一般都是购买)
copying the certifi cate to a special certificate
directory somewhere in /etc , such as/etc/ssl/apache . If you use a script to generate a certificate, the script may do this automatically, or it may place the certifi cate in another directory, such as the main Apache confi guration directory. The certifi cate consists of two files: a certifi cate fi le (which often has a .crt extension) and a key (which often has a .key
extension).
安装证书
LoadModule ssl_module /usr/lib/apache2/modules/mod_ssl.so #支持SSL
Listen
This option binds the server to a particular port. The secure
HTTP port is 443.
SSLEngine
You can set this option to on or off to enable or disable SSL.
SSLRequireSSL
Ordinarily, Apache will deliver files to both ordinary HTTP and
secure HTTP clients. Using this option tells Apache to deliver
files only to clients that have made secure connections. This
directive takes no value, and it is normally placed within a
< Directory > directive block.
SSLCACertificatePath
This directive points to the directory in which the SSL
certificate resides, such as /etc/ssl/apache .
SSLCertificateFile
This directive identifies the SSL certificate file, such as
/etc/ssl/apache/server.crt
3 开启https端口
------------------------------------------
-限制apache用户 (算安全类的
限制连接数 和 连接类型 也能设置验证
大多数时候这个修改是很有必要的。
---------------------------------apache 目录认证
LoadModule auth_module modules/mod_auth.so
htpasswd -c /usr/local/apache2/conf/webpasswd xufei
书上
------------------http压力测试-------------
问题一
一般apache 挺不住 1000并发 在 120秒内 有800-1000 个请求丢失。
解决一
利用iptables 的ip