CentOS7搭建OpenResty Nginx
2016-04-01 17:34
405 查看
下载OpenRestyNginx源码包,按照打包步骤安装,参考文档:
http://openresty.org/cn/installation.html
按照步骤基本都可以正常安装
将Nginx加入系统服务:
网上的方法基本都是在/etc/init.d/目录下创建nginx脚本,但是试了好久都不成功。后来看到可以用另外一种SystemCtl的方式加入系统服务,步骤如下:
1.vi /usr/lib/systemd/system/nginx.service,加入脚本
Description=nginx - high performance web server Documentation=http://nginx.org/en/docs/ After=network.target remote-fs.target nss-lookup.target [Service] Type=forking PIDFile=/usr/local/openresty/nginx/logs/nginx.pid ExecStartPre=/usr/local/openresty/nginx/sbin/nginx -t -c /usr/local/openresty/nginx/conf/nginx.conf ExecStart=/usr/local/openresty/nginx/sbin/nginx -c /usr/local/openresty/nginx/conf/nginx.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target
2.启用nginx.service
systemctl enable nginx.service
3.systemctl start nginx.service就可以启动项目了,基本不再是service nginx reload了。
没有细细研究linux service和systemctl的区别,毕竟不是专业运维,记录下来供后续查资料即可。
阅读更多
相关文章推荐
- 使用Nginx+Unicorn+Capistrano+Sinatra搭建Ruby Web应用
- Ubuntu编译安装PHP和Nginx
- 页面跨域传参 nginx iframe
- linux centos6.7安装nginx1.6 php5.6.15
- nginx基本配置
- nginx虚拟主机的配置
- CentOS 6.4 x86_64 部署 nginx 服务器实现点播功能
- 记一次 nginx 504 Gateway Time-out
- 简单配置nginx使之支持pathinfo
- nginx中配置跨域支持功能
- nginx [alert] 12339#0: 1024 worker_connections are not enough
- 五步教你实现使用Nginx+uWSGI+Django方法部署Django程序
- ubuntu 14.04 编译安装 nginx
- Django Nginx+uwsgi 安装配置
- Nginx-location配置
- NGINX安装
- uwsgi部署到nginx出现invalid request block size: 4161 (max 4096)...skip问题
- nginx moodle php-fpm pm.max_children
- nginx+php测试时显示 502 bad gateway的解决方法
- Nginx编译安装