一:Nginx的证书认证:
# vim /usr/local/lnmp/nginx/conf/nginx.conf
server {
listen 443 ssl;
server_name localhost;
ssl_certificate cert.pem;
ssl_certificate_key cert.pem;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
root html;
index index.html index.htm;
}
}
# cd /etc/pki/tls/certs/
# cp cert.pem /usr/local/lnmp/nginx/conf/
虚拟用户的创建:
# vim /usr/local/lnmp/nginx/conf/nginx.conf
server {
listen 80;
server_name www.lnmp.org;
# access_log logs/lnmp.org.access.log main;
location / {
index index.html;
root /www/www.lnmp.org;
}
}
server {
listen 80;
server_name www.test.org;
# access_log logs/linux.org.access.log main;
location / {
index index.html;
root /www/www.test.org;
}
}
# mkdir /www/www.test.org/ -p
# mkdir /www/www.lnmp.org
# echo "www.lnmp.org" > /www/www.linux.org/index.html
# echo "www.test.org" > /www/www.test.org/index.html
# vim /etc/hosts
192.168.122.10 www.lnmp.org www.test.org
# nginx -t
# nginx -s reload
负载均衡
nginx -t检测无误后,nginx -s reload 重启nginx
阅读(2509) | 评论(0) | 转发(0) |