nginx服务器搭建和配置详解

一、安装编译工具及库文件

依赖库安装,一定要按照顺序安装:

(1) 如果没有安装c++编译环境

?

(2) ssl 功能需要 openssl 库

?

(3) rewrite 模块需要 pcre 库

?

(4) gzip 模块需要 zlib 库

?

(4) nginx安装

?

二、设置依赖库连接

如果输入语句:./usr/local/nginx/sbin/nginx出现错误:

error while loading shared libraries: libpcre.so.0: cannot open shared object file: No such file or directory

可输入:

whereis libpcre.so.1

结果:libpcre.so: /lib64/libpcre.so.1 /usr/local/lib/libpcre.so /usr/local/lib/libpcre.so.0

再使用ln命令,将libpcre.so.0,libpcre.so和libpcre.so.1连接到lib64目录下:

?

三、Nginx 配置

创建 Nginx 运行使用的用户 www:

?

配置ngix.conf, 输入:vi /usr/local/webserver/nginx/conf/nginx.conf的内容修改为:

?

检查配置是否正确:

?

启动:/usr/local/webserver/nginx/sbin/nginx

监听进程:ps -ef|grep nginx

访问服务器IP: 192.168.1.23

nginx服务器搭建和配置详解

问题:配置正确时,也会出现IP地址无法访问的情况:

可以通过阿里云服务器,esc服务器->安全组->配置规则->添加规则,进行配置即可。

nginx服务器搭建和配置详解

nginx服务器搭建和配置详解

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持服务器之家。

原文链接:http://blog.csdn.net/hutianyou123/article/details/77336535



相关文章
推荐文章
热门文章

微信公众号推荐

相关推荐