Linux环境下的nginx配置以及项目部署(springboot+vue)
首先你要知道nginx并不能直接安装在Linux环境中,需要先给它配置一下基本的环境,配置成功后才可以安装。
加载环境(依赖):
//一键安装依赖(其实这个里面应该有四个)
yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
然后下载nginx并解压
wget http://nginx.org/download/nginx-1.13.7.tar.gz
tar -zxvf nginx-1.13.7.tar.gz
进入解压目录并执行安装命令
//执行命令 考虑到后续安装ssl证书 添加两个模块
./configure --with-http_stub_status_module --with-http_ssl_module
//执行make命令
make
//执行make install命令
make install
安装完毕后可以查看一下nginx被安装到哪里去了
这里若是报错了struct crypt_data’ has no member named ‘current_salt’ cd.current_salt[0] = ~salt[0];
这种问题可以配置
1、删objs/Makefile文件中的“ -Werror”
2、注释掉src/os/unix/nginx_user.c第26行的"cd.current_salt[0] = ~salt[0];"
whereis nginx
然后根据提示找到对应目录下面去执行启动命令
root@localhost nginx]# ls
conf html logs sbin
[root@localhost nginx]# cd sbin
[root@localhost sbin]# ls
nginx
[root@localhost sbin]# ./nginx
查看一下是否启动
[root@localhost sbin]# ps -ef | grep nginx
root 4430 1 0 16:17 ? 00:00:00 nginx: master process ./nginx
nobody 4431 4430 0 16:17 ? 00:00:00 nginx: worker process
root 4433 1652 0 16:17 pts/0 00:00:00 grep --color=auto nginx
[root@localhost sbin]#
可以修改conf里面的配置文件nginx.conf进行修改nginx参数配置
修改完成后可执行重启来加载修改好的配置文件
./nginx -s reload
未结束。。。。。