centos7源码安装nginx
2018-09-14 09:03
549 查看
下载:
a. nginx官网及安装包:
a. nginx官网及安装包:
https://nginx.org/en/download.html 或 https://github.com/dollarphper/soft/blob/master/nginx/nginx-1.15.3.tar.gz[/code]
安装:
a. 安装依赖:yum -y install pcre-devel yum -y install zlib-devel
b. 安装nginx:cd nginx的下载目录 tar -xzf nginx-1.15.3.tar.gz cd nginx-1.15.3 ./configure && make && make install
配置:
a. 创建nginx用户:useradd -s /sbin/nologin -M nginx
b. 修改配置文件:
vim /usr/local/nginx/conf/nginx.confuser nginx; worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name localhost; location / { root html; index index.html index.htm; } location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html/$fastcgi_script_name; include fastcgi_params; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }
c. 创建测试文件:echo "hello world" > /usr/local/nginx/html/index.html
启动命令:
a. 启动:/usr/local/nginx/sbin/nginx
b. 停止:/usr/local/nginx/sbin/nginx -s stop
c. 重启:/usr/local/nginx/sbin/nginx -s reload
测试:
相关文章推荐
- 在CentOS7上源码安装最新版的nginx1.11.12
- saltstack 系列(四)centos7使用saltstack源码安装nginx
- CentOS7源码安装nginx
- 一步一步教你centos7安装nginx1.13.4
- Centos7安装nginx
- centos7利用yum安装lnmp的教程(linux+nginx+php7.1+mysql5.7)
- 源码编译安装nginx和python
- Centos7安装Nginx实战
- centos5 源码安装Nginx + mysql + apache + php的方法
- CentOS 6下源码编译安装nginx 1.4.3
- CentOS源码编译安装Nginx
- CentOS7 + Nginx1.13.5 + PHP7.1.10 + MySQL5.7.19 源码编译安装
- nginx在centos7的安装
- Linux下源码安装nginx
- nginx源码安装configure命令的参数介绍
- CentOS7安装Nginx
- CentOS7 下 Zabbix3.4 源码安装
- Nginx笔记(一)----Centos7编译安装Nginx
- nginx 的源码安装
- Nginx 源码安装