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-** 配置)
转载于:https://www.cnblogs.com/xiangwengao/p/3793687.html
CentOS 6.5 Nginx 配置相关推荐
- centos 7.6 —— Nginx 配置网页防盗链FPM参数优化
centos 7.6 -- Nginx 配置网页防盗链&&FPM参数优化 一.网页防盗链 (1)防盗链端--服务端配置(192.168.75.134) 1.1 服务端配置DNS服务,域 ...
- centos 6.9 +nginx 配置GIT HTTPS服务器(证书采用自签名)
第一部分原通过SSH访问的GIT服务器迁移 1.把原服务器GIT资源库目录完成复制至新的服务器 2.安装GIT服务器 新的服务器 创建用户 useradd git password git 下载GIT ...
- CentOS 6.4安装配置LNMP服务器(Nginx+PHP+MySQL)
这篇文章主要介绍了CentOS 6.4下配置LNMP服务器的详细步骤,需要的朋友可以参考下 准备篇 1.配置防火墙,开启80端口.3306端口 vi /etc/sysconfig/iptables - ...
- CentOS服务器下nginx防盗链介绍与配置
转载来源 : CentOS服务器下nginx防盗链介绍与配置 : safebase.cn/article-256622-1.html 一.防盗链介绍 1.什么是防盗链 简单的说,就是某些不法的网站,通 ...
- CentOS 7上编译安装PHP 8.1及Nginx 配置支持PHP
CentOS 7上编译安装PHP 8.1/及Nginx 配置支持PHP 编译安装 Php[端口:9000] 安装编译环境依赖包 yum -y install gcc gcc-c++ glibc aut ...
- linux nginx rpm 安装配置,Centos下安装nginx rpm包
1 在nginx官方网站下载一个rpm包,下载地址是:http://nginx.org/en/download.html wget http://nginx.org/packages/centos/6 ...
- 阿里云ECS(Centos)中Nginx安装及配置
Nginx是一个高性能的http和反向代理web服务器,本篇在记录阿里云ECS中安装及配置Nginx的过程.Nginx作为系统关键服务,下面流程全部在root用户下完成. 系统:CentOS 8.0 ...
- Centos 7离线安装Nginx 配置负载均衡集群
场景 项目中有三台应用服务器,系统为Centos 7 ,应用地址分别为: 192.168.198.229:8080 192.168.198.230:8080 192.168.198.231:8080 ...
- CentOS rpm安装Nginx和配置
CentOS rpm安装Nginx和配置 官方下载地址: http://nginx.org/en/download.html 介绍 Nginx("engine x")是一款由俄罗斯 ...
最新文章
- 数据权限设计思路_后台权限管理设计思路:三种模型分析
- linux i2c 设备 操作说明
- 【Android 事件分发】事件分发源码分析 ( ViewGroup 事件传递机制 二 )
- 创建 Spring容器的三种方式
- ubuntu下安装opensips
- python更新excel内容_使用python将Excel表中的数据更新到数据库中
- 全栈python_Pyodide:在浏览器端实现Python全栈科学计算
- [转载] Java默认构造方法
- Atitit 常见软件设计图纸总结 目录 1.1. ui原型图与html	2 1.2. 业务逻辑 伪代码 各种uml图	2 1.3. 总体设计图纸 结构图 层次图 架构图	2 1.4. 业务逻辑
- java 文件存在 却找不到文件_当文件确实存在时,ProcessBuilder给出“找不到文件”异常...
- 微信小程序转盘实现(真心话大冒险)
- 经济学人:数据经济虽好,可是仍需补钙
- 图灵奖得主Bengio和LeCun称自监督学习可使AI达到人类智力水平
- 单片机数码管显示原理
- DOS的net命令详解
- 带weixin扫码登陆注册|仿城通网盘源码修复版
- 如何把很多照片拼成一张照片_如何将多张图片合成一个PDF文件
- 1143 Lowest Common Ancestor
- docker mysql redis 镜像详解
- 前端开发日报:20190818
热门文章
- pandas groupby count_数据分析14-利用pandas进行数据分组
- eclipse调试java web_eclipse调试web项目
- 为什么使用linux内核,为什么Linux内核使用它所做的数据结构?
- flink sink jdbc没有数据_No.2 为什么Flink无法实时写入MySQL?
- 一个优雅的后端API接口样例和代码实现方案
- 超级计算机开采金矿,科学家发现地球内部有超60万亿吨金矿,为什么没人敢开采?...
- C语言学习笔记---结构体作为函数参数和返回值
- Servlet之第一个web项目
- VC socket 发送类对象
- struts html:radio标签的初始值与判断