# LNMP系列(一)nginx源码安装
## 下载安装过程
```bash
cd /root/
mkdir tools
cd tools/
yum install openssl openssl-devel -y
yum install pcre pcre-devel -y
useradd www -s /sbin/nologin -M
wget -q http://nginx.org/download/nginx-1.14.0.tar.gz
tar xf nginx-1.14.0.tar.gz
cd nginx-1.14.0
./configure --user=www --group=www --with-http_ssl_module --with-http_stub_status_module --prefix=/apps/nginx-1.14.0/
make
make install
ln -s /apps/nginx-1.14.0/ /apps/nginx
```
## 检查 重启
```
/apps/nginx/sbin/nginx -t
/apps/nginx/sbin/nginx -s reload
```
## 配置文件
```
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 10.0.0.61; # 域名
location / {
root /mnt/hgfs/rpm; # 网站根目录
index index.html index.htm;
autoindex on; # 目录列表
autoindex_exact_size off;
autoindex_localtime on;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
```