安装pcre库 [root@lnmp01 ~]# rpm -qa pcre pcre-devel [root@lnmp01 ~]# yum install -y openssl openssl-devel [root@lnmp01 ~]# rpm -qa pcre pcre-devel pcre-devel-7.8-7.el6.x86_64 pcre-7.8-7.el6.x86_64 编译安装nginx-1.6.3 [root@lnmp01 ~]# rpm -qa nginx [root@lnmp01 ~]# mkdir /home/lufeng/tools -p [root@lnmp01 ~]# cd /home/lufeng/tools/ [root@lnmp01 tools]# wget -q http://nginx.org/download/nginx-1.6.3.tar.gz [root@lnmp01 tools]# tar xf nginx-1.6.3.tar.gz [root@lnmp01 tools]# cd nginx-1.6.3 [root@lnmp01 nginx-1.6.3]# useradd nginx -s /sbin/nologin -M [root@lnmp01 nginx-1.6.3]# ./configure --prefix=/application/nginx-1.6.3 --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module [root@lnmp01 nginx-1.6.3]# make [root@lnmp01 nginx-1.6.3]# make install [root@lnmp01 tools]# ln -s /application/nginx-1.6.3/ /application/nginx 启动并检查nginx服务 [root@lnmp01 tools]# /application/nginx/sbin/nginx -t nginx: the configuration file /application/nginx-1.6.3/conf/nginx.conf syntax is ok nginx: configuration file /application/nginx-1.6.3/conf/nginx.conf test is successful [root@lnmp01 tools]# /application/nginx/sbin/nginx [root@lnmp01 tools]# netstat -lntup|grep nginx [root@lnmp01 tools]# wget 127.0.0.1 [root@lnmp01 tools]# curl 127.0.0.1 基于多域名的虚拟主机配置 配置文件: [root@lnmp01 conf]# cat nginx.conf worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; include extra/www.conf; include extra/blog.conf; include extra/bbs.conf; } [root@lnmp01 conf]# cat ./extra/www.conf server { listen 80; server_name www.lufeng.com; location / { root html/www; index index.html index.html; } } [root@lnmp01 conf]# cat ./extra/bbs.conf server { listen 80; server_name bbs.lufeng.com; location / { root html/bbs; index index.html index.html; } } [root@lnmp01 conf]# cat ./extra/blog.conf server { listen 80; server_name blog.lufeng.com; location / { root html/blog; index index.html index.html; } }
本文出自 “大梦初醒” 博客,请务必保留此出处http://bestlufeng.blog.51cto.com/11790256/1910952
原文地址:http://bestlufeng.blog.51cto.com/11790256/1910952