nginx安装
1、安装wget
yum -y install wget
2、cd到安装位置下载安装包
wget http://nginx.org/download/nginx-1.16.1.tar.gz
3、解压
tar -zxvf nginx-1.16.1.tar.gz
4、安装编译工具以及库文件
yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel
5、进入nginx目录
6、编译安装
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
make
make install
7、查看nginx版本
/usr/local/nginx/sbin/nginx -v
安装完成!
8、上传https证书
mkdir /usr/local/nginx/ssl
9、配置nginx
将nginx_https.conf上传到/usr/local/nginx/conf/下
10、进入/usr/local/nginx/sbin启动nginx
/usr/local/nginx/sbin
./nginx -c /usr/local/nginx/conf/nginx_https.conf
nginx启动成功!
11、防火墙放开80和443端口
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --zone=public --add-port=443/tcp --permanent
重启防火墙
systemctl restart firewalld.service
检查端口
firewall-cmd --list-ports
12、上传项目
解压
tar -zxvf front.tar.gz front
13、创建存放图片目录
mkdir /data
mkdir /swj
mkdir /images
14、浏览器访问
输入:https://ip/front/index.html
输入:https://ip/images/3.png
成功。