11
解决Ubuntu配置nginx出现的问题
source link: https://segmentfault.com/a/1190000038247421
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Ubuntu18.04配置nginx出现的各种错误
- 缺少 pcre库
编译nginx
出现错误
安装pcre库,出现错误
手动编译安装pcre库
(1)下载并解压pcre库
wget https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz tar -xvf pcre-8.43.tar.gz
(2)编译安装pcre库
cd pcre-8.43 sudo ./configure sudo make sudo make install
重新编译nginx
#在nginx-1.12.2目录下 sudo ./configure --with-stream
命令执行成功
-
出现"struct crypt_data"没有名为"current_salt"成员的错误
执行make命令
sudo make && make install
出现"struct crypt_data"没有名为"current_salt"成员的错误
解决方案:进入相应路径,将源码的第36行注释
sudo vi src/os/unix/ngx_user.c
重新执行sudo make && make install命令
- 出现-Werror=cast-function-type错误
解决方案
#进入nginx-1.12.2目录下的objs目录 cd objs #修改Makefile文件 sudo vi Makefile
重新回到nginx-1.12.2目录下执行sudo make && make install命令
- make命令出现权限不够错误
进入root模式执行命令
sudo su #进入root模式 make && make install
- nginx启动出现无法连接 pcre库 错误
查看依赖库
到/usr/local/lib目录下查看
设置软连接
#回到nginx下的sbin目录 cd /usr/local/nginx/sbin #设置软连接 ln -s /usr/local/lib/libpcre.so.1.2.11 libpcre.so.1 #设置LD_LIBRARY_PATH(注:这种方法,每次开启nginx都需要重新设置LD_LIBRARY_PATH) export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
重新启动nginx
./nginx # 查看服务是否正常启动 netstat -tanp
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK