码迷,mamicode.com
首页 > 其他好文 > 详细

nginx

时间:2019-01-06 16:29:55      阅读:137      评论:0      收藏:0      [点我收藏+]

标签:cgi   log   cal   org   端口   configure   evel   yum   ica   

linux 下载
wget http://nginx.org/download/nginx-1.4.7.tar.gz
然后切换到nginx-1.4.7
检查
./configure --prefix=/usr/local/nginx

报如下错

./configure: error: the HTTP rewrite module requires the PCRE library.

You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.

说明缺少 正则包
然后 yum install pcre
如果提示已经是最新的
那么
yum install pcre-devel

    然后在 ./configure --prefix=/usr/local/nginx

    如果再报错
    ./configure: error: the HTTP gzip module requires the zlib library.

You can either disable the module by using --without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using --with-zlib=<path> option.


yum install -y zlib-devel

./configure --prefix=/usr/local/nginx
出现下边的提示则说明成功

nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx"
nginx configuration prefix: "/usr/local/nginx/conf"
nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
nginx pid file: "/usr/local/nginx/logs/nginx.pid"
nginx error log file: "/usr/local/nginx/logs/error.log"
nginx http access log file: "/usr/local/nginx/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"

然后
make && make install

先说明一下nginx的主目录
conf 配置文件
html网页文件
logs 日志文件
sbin主要的二进制程序

然后启动nginx
sbin目录下
./nginx

出现
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()

说明80端口有人在用

查看一下
netstat -antp

二.nginx信号量

查看 nginx的进程
ps aux|grep nginx
8998 是nginx的进程号

kill -int 8998 快速关闭
kill -quit 8998 优雅的关闭
kill -hup 8998 开启新进程,关闭旧进程
在配置文件修改后 可以使用 hup 重新开启即可

kill -usr1 8998
把旧的日志文件备份
添加新的日志文件后
就会把记录记录到新日志文件中

kill -usr2 8998

kill -winch
平滑升级用 winch配合usr2 升级用

nginx

标签:cgi   log   cal   org   端口   configure   evel   yum   ica   

原文地址:http://blog.51cto.com/13800637/2339391

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!