源码安装nginx

cat /etc/redhat-release
uname -rm
yum install pcre-devel openssl-devel -y
rpm -qa pcre pcre-devel openssl openssl-devel
groupadd -g 888 nginx
useradd nginx -u 888 -g nginx -s /sbin/nologin -M
mkdir -p /server/tools
cd /server/tools
wget -q http://nginx.org/download/nginx-1.6.3.tar.gz
tar xf nginx-1.6.3.tar.gz
cd nginx-1.6.3
./configure --user=nginx --group=nginx --prefix=/application/nginx-1.6.3 --with-http_stub_status_module --with-http_ssl_module
make
make install
ln -s /application/nginx-1.6.3 /application/nginx
/application/nginx/sbin/nginx -t
/application/nginx/sbin/nginx
ps -ef | grep nginx
lsof -i :80
curl 10.0.0.41

虚拟主机配置

cd /application/nginx-1.6.3/conf/
egrep -v "^$|#" nginx.conf.default > nginx.conf
mkdir extra
mkdir ../html/{www,blog,bbs}
chown -R nginx.nginx ../html
vim nginx.conf worker_processes 1;
error_log logs/error.log error;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
log_format main '$remote_addr - $remote_user [$time_local] "$request"'
'$status $body_bytes_sent "$http_referer"'
'"$http_user_agent" "$http_x_forwarded_for"';
include extra/www.conf;
include extra/blog.conf;
include extra/bbs.conf;
include extra/status.conf;
} vim extra/www.conf server {
listen 80;
server_name www.peterwang.com;
root html/www;
index index.html index.htm;
error_page 500 502 503 504 /50x.html;
access_log logs/access_www.log main;
location / { }
} vim extra/blog.conf server {
listen 80;
server_name blog.peterwang.com;
root html/blog;
index index.html index.htm;
error_page 500 502 503 504 /50x.html;
access_log logs/access_blog.log main;
location / { }
} vim extra/bbs.conf server {
listen 80;
server_name bbs.peterwang.com;
root html/bbs;
index index.html index.htm;
error_page 500 502 503 504 /50x.html;
access_log logs/access_bbs.log main;
location / { }
} vim extra/status.conf server {
listen 80;
server_name status.peterwang.com;
location / {
stub_status on;
access_log off;
allow 10.0.0.0/24;
deny all;
}
} ../sbin/nginx -s reload

最新文章

  1. SmartAssembly使用失败记录
  2. BZOJ 4003 【JLOI2015】城池攻占
  3. ASP.NET SignalR 与LayIM配合,轻松实现网站客服聊天室(二) 实现聊天室连接
  4. DBCC Check
  5. js解析json,js转换json成map,获取map的key,value
  6. 在Servlet中使用spring注入的bean
  7. 1101: 零起点学算法08——简单的输入和计算(a+b)
  8. java环境变量配置原理解析以及eclipse导入外包的方法
  9. 【Android 应用开发】 Android 各种版本简介 ( Support 支持库版本 | Android Studio 版本 | Gradle 版本 | jcenter 库版本 )
  10. mysql left join 优化
  11. 恒生UFX接口引用计数心得
  12. c#所有部门及其下所部门生成树形图(递归算法获取或键值对方式获取)
  13. android -------- Data Binding的使用(三)Observable
  14. 2018.10.30 uoj#273. 【清华集训2016】你的生命已如风中残烛(组合数学)
  15. 使用 Leaflet 显示 ArcGIS 生成西安80坐标的地图缓存
  16. zabbix安装配置2
  17. ES6系列_11之Set和WeakSet数据结构
  18. httpclient4.5 https请求 忽略身份验证
  19. day19 Models补充+缓存+信号+序列化+分析抽屉页面
  20. HCNA配置手工负载分担模式链路聚合

热门文章

  1. 【转】ssh登录原理以及ssh免密码登陆
  2. Cornfields POJ - 2019(二维RMQ板题)
  3. Golden Tiger Claw UVA - 11383(km原理)
  4. 【洛谷】CYJian的水题大赛【第二弹】解题报告
  5. Mybatis笔记四:nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'id' in 'class java.lang.String'
  6. Native Wifi API
  7. Contest Record
  8. springboot读取自己定义的配置文件的方式以及使用joda_time来处理时间日期
  9. HTTP ------ connection 为 close 和 keep-alive 的区别
  10. ACE服务端编程2:ACE跨平台之数据类型和宽字符