云服环境搭建-nginx

# 前置工具
yum install gcc-c++ # y
yum install -y pcre pcre-devel
yum install -y zlib zlib-devel
yum install -y openssl openssl-devel
yum install wget

# 使用wget命令下载
wget -c https://nginx.org/download/nginx-1.12.0.tar.gz

# 解压
tar -zxvf nginx-1.12.0.tar.gz
cd nginx-1.12.0

# 配置 如果后续需要 https 该步骤替换为
# ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
./configure

# 编译安装
make
make install

# 查找安装路径
whereis nginx # nginx: /usr/local/nginx

# 启动、停止nginx
cd /usr/local/nginx/sbin/
./nginx 
./nginx -s stop
./nginx -s quit
./nginx -s reload

安装完成后可以将 nginx 命令写到环境变量里方便使用。

nginx
24 views
Comments
登录后评论
Sign In