# nginx安裝
在home目錄下創建一個src目錄
cd src目錄
```
wget http://nginx.org/download/nginx-1.12.2.tar.gz 下載
```
```
tar -xf tar -xf nginx-1.12.2.tar.gz 解壓壓縮包
```
```
cd nginx-1.12.2 打開文件夾
```
```
groupadd www 創建組
```
```
useradd -g www www -M -s /sbin/nologin //創建目錄與權限
```
```
./configure --help 所有配置的列表項目選擇
```
以下為配置文件--user=www 是修改成了www --group=www 是修改成了www
, prefix=/usr/local/nginx 為安裝目錄
```
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-http_sub_module --with-pcre
```
```
注意::(如果出現 ./configure: error: C compiler cc is not found錯誤)yum install gcc gcc++ -y 解決安裝gcc
注意:: 出現 (./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 -y install pcre-devel 安裝PCRE
注意::出現(./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl=<path> option.
)錯誤后
yum -y install openssl openssl-devel 安裝OpenSSL解決
```
## 出現這個為安裝成功

檢測上個語法0錯誤

# 執行 安裝命令
```
make && make install
```

# nginx安裝成功
nginx目錄
```
ll /usr/local/nginx/
```

# 啟動nginx
關閉防火墻
```
systemctl stop firewalld.service
```
<br/>
ll /usr/local/nginx
進入nginx目錄
nginx在根目錄下 /usr/local/nginx
```
cd /usr/local/nginx
cd sbin
./nginx
```
# 啟動成功

## 外網訪問成功