CentOS 6.5 Nginx 配置
1.安装所有 http功能:
./configure --user=www-data --group=www-data --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_geoip_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module
错误:
./configure: error: the HTTP image filter module requires the GD library.
./configure: error: the GeoIP module requires the GeoIP library
1.1 安装 GeoIP (区分大小写)
yum install GeoI GeoIP-data GeoIP-devel
完毕以后,还需要到MaxMind去下一个GeoCityLite,待会php程序要用到。
下载完毕以后,将压缩包解压出数据库的.dat文件,并把文件重命名为GeoIPCity.dat,然后移动到GeoIP的数据文件夹下。
mv GeoLiteCity.dat /usr/share/GeoIP/GeoIPCity.dat
1.2 安装gd
yum install gd-devel
参考:http://www.cnblogs.com/tintin1926/archive/2012/07/11/2586624.html
1.3帐号用户配置
--user=www-data --group=www-data 表示帐号和用户, 这两个应该都是已经存在的, 若不存在则在配置晚Nginx后需要添加这两个帐号或者修改 nginx.conf配置为user nobody, 详细见 4.1
至此,configure 成功
2. make
没有出现错误提示;成功。
出现 make[1]: Leaving directory `/home/gxw/Downloads/nginx-1.6.0'
3. make install
没出先错误提示, 成功。
安装路径为:/usr/local/nginx/
出现
[root@localhost nginx-1.6.0]# make install
make[1]: Leaving directory `/home/gxw/Downloads/nginx-1.6.0'
4 安装后运行出现的错误:
4.1 [root@localhost sbin]# ./nginx
nginx: [emerg] getpwnam("www-data") failed
原因: 没有创建www这个用户
解决:
4.1.1 添加www用户组和用户www,如下命令:
#/usr/sbin/groupadd -f www
#/usr/sbin/useradd -g www www
[root@localhost conf]# vim nginx.conf
第1行: # user nobody; 去掉注释即删除#
发现: /usr/local/nginx/conf/nginx.conf 文件中
添加; 后,测试成功。显示为:
[root@localhost sbin]# ./nginx -t
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
4.3 普通用户 gxw无法启动nginx
4.3.1 出现错误:
[gxw@localhost sbin]$ ./nginx
nginx: [alert] could not open error log file: open() "/usr/local/nginx/logs/error.log" failed (13: Permission denied)
2014/07/01 21:12:13 [warn] 4882#0: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /usr/local/nginx/conf/nginx.conf:2
2014/07/01 21:12:13 [emerg] 4882#0: open() "/usr/local/nginx/logs/access.log" failed (13: Permission denied)
原因是:默认情况下linux的1024以下端口是只有root用户才有权限占用
而gxw:gxw属于gxw组布局被root权限。
并且Log文件也是root权限。gxw也不具备。
4.3.2解决:
方法一:采用了该方法
所有用户都可以运行(因为是755权限,文件所有者:root,组所有者:root)
chown root:root nginx
chmod 755 nginx
chmod u+s nginx
方法二:
仅 root 用户和 reistlin 用户可以运行(因为是750权限,文件所有者:root,组所有者:www)
chown root:www nginx
chmod 750 nginx
chmod u+s nginx
5. 成功运行
进入:/usr/local/nginx/sbin/
[root@localhost sbin]# ./nginx 开启Nginx
打开浏览器输入:127.0.0.1
显示页面:
6. 使用命令
/usr/local/nginx/nginx -V 查看版本 和 配置信息(编译前的 --with-** 配置)
CentOS 6.5 Nginx 配置的更多相关文章
- CentOS 7 安装 Nginx 配置反向代理
Linux使用Nginx Yum存储库上安装Nginx,适用于Red Hat Enterprise Linux和CentOS系统. 1.添加设置Nginx Yum存储库 在CentOS中首次安装Ngi ...
- centos 6.9 +nginx 配置GIT HTTPS服务器(证书采用自签名)
第一部分原通过SSH访问的GIT服务器迁移 1.把原服务器GIT资源库目录完成复制至新的服务器 2.安装GIT服务器 新的服务器 创建用户 useradd git password git 下载GIT ...
- 在CentOS上安装Nginx配置HTTPS并设置系统服务和开机启动(最全教程)
友情提示:全部配完大约需要20分钟,本教程配合 xshell 和 xftp 使用更佳. 系统配置:CentOS 7.5 本教程 摘繁华 版权所有. 操作按键 常用按键: 复制操作:Shift+Ins ...
- centos下使用nginx 配置websocket,https升级wss协议
服务端代码/***/ // 服务端代码 var express = require('express'); var app = express(); var path = require('path' ...
- 【CentOS 7】nginx配置web服务器
1,安装过程 [root@VM_1_14_centos ~]# cd /data/ [root@VM_1_14_centos data]# wget http://nginx.org/download ...
- 一些NGINX配置
一些nginx配置 使用独立目录, 然后include具体配置 gzip on for multi processers static file cache proxy pass 静态目录 or 文件 ...
- CentOS 6.5安装配置LNMP服务器(Nginx+PHP+MySQL)
CentOS 6.5安装配置LNMP服务器(Nginx+PHP+MySQL) 一.准备篇: /etc/init.d/iptables stop #关闭防火墙 关闭SELINUX vi /etc/sel ...
- CentOS 6.6 nginx PHP 配置
/************************************************************************* * CentOS 6.6 nginx PHP 配置 ...
- CentOS 6.5安装配置Nginx
Ubuntu下安装nginx,直接apt-get install nginx就行了,很方便. 但是今天装了CentOS6.5,直接yum install nginx不行,要先处理下源,下面是安装完整流 ...
随机推荐
- H5案例分享:JS手势框架 —— Hammer.js
JS手势框架 -- Hammer.js 一.hammer.js简介 hammerJS是一个开源的,轻量级的触屏设备javascript手势库,它可以在不需要依赖其他东西的情况下识别触摸,鼠标事件.允许 ...
- jquery 页面滚动到底部自动加载插件集合
很多社交网站都使用无限滚动的翻页技术来提高用户体验,当你页面滑到列表底部时候无需点击就自动加载更多的内容.下面为你推荐 10 个 jQuery 的无限滚动的插件: 1. jQuery ScrollPa ...
- Linux远程执行Shell命令或脚本
## 远程执行shell命令 ssh [user]@[server] '[command]' # eg. ssh root@192.168.1.1 'uptime' ## 远程执行本地shell脚本 ...
- git: fatal: Not a git repository (or any of the parent directories): .git
在看书 FlaskWeb开发:基于Python的Web应用开发实战 时,下载完源码后 git clone https://github.com/miguelgrinberg/flasky.git 试着 ...
- poj 3614
http://poj.org/problem?id=3614 题意:有n头奶牛想要晒太阳,但他们每个人对太阳都有不同的耐受程度,也就是说,太阳不能太大也不能太小,现在有一种防晒霜,涂抹这个防晒霜可以把 ...
- 设计模式--适配器模式Adapter(结构型)
一.适配器模式 适配器模式的主要作用是在新接口和老接口之间进行适配.将一个类的接口转换成客户端期望的另外一个接口.其实适配器模式有点无赖之举,在前期设计的时候,我们就不应该考虑适配器模式,而应该通过重 ...
- Swift3新特性汇总
之前 Apple 在 WWDC 上已将 Swift 3 整合进了 Xcode 8 beta 中,而本月苹果发布了 Swift 3 的正式版.这也是自 2015 年底Apple开源Swift之后,首个发 ...
- Java学习笔记__异常机制_try_catch_finally_return执行顺序
package cn.xiaocangtian.Exception; import java.io.FileInputStream; import java.io.FileNotFoundExcept ...
- **SQL某一表中重复某一字段重复记录查询与处理
sql某一表中重复某一字段重复记录查询与处理 1.查询出重复记录 select 重复记录字段 form 数据表 group by houseno having count(重复记录字段)> ...
- Python 逐行修改txt每条记录的内容
Txt中保存以些数据,这些数据中我们要逐行read line出来进行处理,约定第一个字符为"#"的数据表示已经处理. 一个办法是读取txt,新增另外一个已完成处理txt来保存完成的 ...