网站首页 > 技术教程 正文
最新小猿正在把项目进行服务器的迁移,之前用的是windows server 服务器,现在全部改成linux服务器。然后就自己装个虚拟机,然后搞搞搞~~~在搞的过程中,遇到很多搞错问题,我整理成了一些干货,分享出来,博客园帖子相关帖子很多,就不往那上面写了。为啥说是干货呢???小猿这是一步一步趟雷趟过来的。好了,不说废话了,咱们马上开始。
下载“nginx-1.9.9.tar.gz”,移动到/usr/local/下。(nginx Linux版官网下载:http://nginx.org/download/)
1.解压
#tar -zxvf nginx-1.9.9.tar.gz
2.进入nginx目录
#cd nginx-1.9.9
3. 配置
# ./configure --prefix=/usr/local/nginx
在这里小猿遇到个问题:
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.
编译安装nginx需要pcre包时报错,所以我们要先下载安装pcre的devel包,pcre-devel。
解决:#yum -y install pcre-devel
安装后这个问题解决了,但是又出现一个新的问题:
./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using --without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using --with-zlib=<path> option.
同样是zlib等依赖包没有安装。
解决:#yum install -y zlib-devel
之后会显示出一些重要信息:
Configuration summary
+ using system PCRE library
+ OpenSSL library is not used
+ using builtin md5 code
+ sha1 library is not found
+ using system zlib library
出现这个,就是已经完成了。
开始执行 make、make install命令
#make
#make install
执行完后正常输出
正常情况的信息输出:
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
这样nginx就正常启动了。
如果发现报错输出:
nginx: [alert] could not open error log file: open() "/usr/local/nginx/logs/error.log" failed (2: No such file or directory)
2016/09/13 19:08:56 [emerg] 6996#0: open() "/usr/local/nginx/logs/access.log" failed (2: No such file or directory)
原因分析:nginx/目录下没有logs文件夹
解决:
#mkdir logs
#chmod 700 logs
启动nginx
cd /usr/local/nginx/sbin
./nginx //启动nginx
在浏览器中输入IP地址:192.168.244.131(不要端口号,默认监听80端口)
然后我们会得到Welcome to nginx!证明配置成功了
猜你喜欢
- 2024-10-10 Linux下Docker部署Nginx并配置IPv6,实现公网访问
- 2024-10-10 nginx-linux服务器内核参数的优化
- 2024-09-12 如何在 LINUX 虚拟机上安装 NGINX Web 服务器
- 2024-09-12 【linux】Nginx 反向代理与负载均衡
- 2024-09-12 linux 安装nginx(linux安装nginx1.8)
- 2024-09-12 Linux下Nginx相关常用操作(linux+nginx)
- 2024-09-12 Linux搭建nginx,在window环境中访问
- 2024-09-12 nginx在linux下如何安装(linux怎么安装nginx)
- 2024-09-12 linux服务器下Nginx的搭建和部署(linux服务器nginx集群搭建)
- 2024-09-12 Linux运维笔记——Nginx详细安装部署
你 发表评论:
欢迎- 最近发表
- 标签列表
-
- 下划线是什么 (87)
- 精美网站 (58)
- qq登录界面 (90)
- nginx 命令 (82)
- nginx .http (73)
- nginx lua (70)
- nginx 重定向 (68)
- Nginx超时 (65)
- nginx 监控 (57)
- odbc (59)
- rar密码破解工具 (62)
- annotation (71)
- 红黑树 (57)
- 智力题 (62)
- php空间申请 (61)
- 按键精灵 注册码 (69)
- 软件测试报告 (59)
- ntcreatefile (64)
- 闪动文字 (56)
- guid (66)
- abap (63)
- mpeg 2 (65)
- column (63)
- dreamweaver教程 (57)
- excel行列转换 (56)
本文暂时没有评论,来添加一个吧(●'◡'●)