标签:
下载源码包http://nginx.org/
http://nginx.org/en/download.html
yum -y install "@开发工具" pcre pcre-devel openssl openssl-devel tar -zxvf nginx-XXXX.tar.gz ./configure --help ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_ssl_module make && make install useradd -s /sbin/nologin -M www
/usr/local/nginx/sbin/nginx 选项 -h -s stop 停止nginx进程 -v 查看软件版本 -V 安装软件时的配置参数 -c 指定nginx进程使用那个配置文件运行 -t 检查默认的配置文件nginx.conf是否有语法错误
pkill -9 nginx kill 信号 pid号 -int -quit -HUP -USR1 -USR2 -WINCH kill -HUP `cat /usr/local/nginx/logs/nginx.pid`
基本网站服务
http {
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html;
}
location 路径 {
root html;
index index.html;
}
}
server {
}
}
基于域名的虚拟主机 : 发布给公网客户端
基于端口 + 基于ip : 在私有网络发布网站后台管理页面
server {
listen 80;
server_name www.xzdz.hk;
location / {
root /wwwdir;
index index.html index.htm;
}
.....
.....
}
server {
listen 80;
server_name bbs.xzdz.hk;
location / {
root /bbsdir;
index index.html;
}
}
server {
listen 80;
location / {
root html;
index index.html;
}
}
server {
listen 8000;
location / {
root /bbsdir;
index index.html;
}
server {
listen 8090;
location / {
root /wwwdir;
index index.html;
}
}
server {
listen 1.1.1.253:8080;
location / {
root /admindir;
index index.html;
}
}
server {
listen 1.1.1.254:80;
location / {
root /wwwdir;
index index.html;
}
}
server {
listen 1.1.1.253:80;
location / {
root /bbsdir;
index index.html;
}
}
标签:
原文地址:http://www.cnblogs.com/kamil/p/5167368.html