nginx
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了nginx,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2484字,纯文字阅读大概需要4分钟。
内容图文
![nginx](/upload/InfoBanner/zyjiaocheng/977/38cee69d47e8408ebc9a9086f488ce96.jpg)
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全部内容,希望文章能够帮你解决nginx所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。