准备用flask作一个本身的博客网站,打算用Nginx来部署,因此在阿里云的服务器上安装Nginx,参考了不少教程,如今将步骤以及本身遇到的坑写下来,但愿能对别人有所帮助。html
我用的服务器是阿里云的ubuntu 16.04 64位nginx
包名 | 地址 | 安装方式 |
---|---|---|
pcre | http://www.pcre.org/ | 解压目录下./configure ->make ->make install |
openssl | http://www.openssl.org/source/ | 解压目录下./config ->make ->make install |
zlib | http://www.zlib.net/ | 解压目录下./configure ->make ->make install |
安装方式相似三个依赖模块,地址:http://nginx.org/en/download.htmlshell
Nginx 默认安装路径是/usr/local/nginx
flask
启动:sudo /usr/local/nginx/sbin/nginx
ubuntu
查看进程:ps ajx|grep nginx
服务器
中止:sudo /usr/local/nginx/sbin/nginx -s stop
网站
若是启动成功:
ui
若是不安装上面提到的三个依赖包,在Nginx文件夹下直接make
,则会报make: *** No rule to make target 'build', needed by 'default'. Stop.
阿里云
error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory
.net
检测缘由所在 ldd $(which /usr/local/nginx/sbin/nginx)
执行结果如图:
缘由是库文件少了libcrypto.so.1.1文件,显示为Not found.接下来查看openssl version
,而且输入出的结果以下图所示:
报错信息是:openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
键入命令:
ln -s /usr/local/lib/libssl.so.1.1 /usr/lib/libssl.so.1.1 ln -s /usr/local/lib/libcrypto.so.1.1 /usr/lib/libcrypto.so.1.1
再次输入 ldd $(which /usr/local/nginx/sbin/nginx
结果以下
启动Nginx再也不报错。