标签:nginx
#创建目录
mkdir -p /application/tools
#切换到此目录下
cd /application/tools
#安装依耐包
yum install openssl openssl-devel pcre pcre-devel -y
#获取源文件
wget -q http://nginx.org/download/nginx-1.6.3tar.gz
#创建用户并授权 -s指定用户的登录shell -M 不创建家目录
useradd www -s /sbin/nologin -M
#解压
tar xf nginx-1.6.3.tar.gz
#切换到此目录下
cd nginx-1.6.3
#配置文件
./configure --user=www --group=www --with-http_ssl_module
--with-http_stub_status_module --prefix=/application/nginx-1.6.3/
#编译
make
#安装
make install
#创建软连接,当软件升级时,只改变只想就可以了,而不需要改变每一个小处
ln -s /application/nginx-1.6.3 /application/nginx
#nginx.conf代码:
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name bbs.xdxd.cn;
location / {
root html/bbs;
index index.html index.htm;
}
}
server {
listen 80;
server_name www.xdxd.cn;
location / {
root html/www;
index index.html index.htm;
}
}
server {
listen 80;
server_name blog.xdxd.cn;
location / {
root html/blog;
index index.html index.htm;
}
}
}
本文出自 “7177651” 博客,请务必保留此出处http://7187651.blog.51cto.com/7177651/1844293
标签:nginx
原文地址:http://7187651.blog.51cto.com/7177651/1844293