1. Install Nginx software prerequisites :
$ sudo yum install pcre pcre-devel openssl-devel perl gcc make -y

  

2. Download Nginx from official website and extract it :
$ wget http://nginx.org/download/nginx-1.6.2.tar.gz
$ tar xzvf nginx-1.6.2.tar.gz
 
 
3. 用户权限设置 chown -R group:user
# chown -R youaijj:youaijj /home/youaijj
 
 
4. make owner directory(在youaijj用户下执行)
配置文件:
$ mkdir /home/youaijj/etc
执行文件:
$ mkdir /home/youaijj/usr
日志等:
$ mkdir /home/youaijj/var

  

5. Go to the extracted directory and start Compiling and install Nginx :
$ cd nginx-1.6.2
$ ./configure --prefix=/home/youaijj/etc/nginx --sbin-path=/home/youaijj/usr/sbin/nginx --conf-path=/home/youaijj/etc/nginx/nginx.conf --error-log-path=/home/youaijj/var/log/nginx/error.log --http-log-path=/home/youaijj/var/log/nginx/access.log --pid-path=/home/youaijj/var/run/nginx.pid --lock-path=/home/youaijj/var/run/nginx.lock --http-client-body-temp-path=/home/youaijj/var/cache/nginx/client_temp --http-proxy-temp-path=/home/youaijj/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/home/youaijj/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/home/youaijj/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/home/youaijj/var/cache/nginx/scgi_temp --user=youaijj --group=youaijj--with-http_ssl_module --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6 --with-http_spdy_module --with-cc-opt='-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic'
“--” 不要换行。查看其他选项:$ ./configure --help
configure的另外方式,换行使用“\”
$ ./configure \
--prefix=/home/youaijj/etc/nginx \
--sbin-path=/home/youaijj/usr/sbin/nginx \
--conf-path=/home/youaijj/etc/nginx/nginx.conf \
--error-log-path=/home/youaijj/var/log/nginx/error.log --http-log-path=/home/youaijj/var/log/nginx/access.log \
...
...
 
 
6. Still in the current, nginx-1.x.x directory, issue the installation command as below :
$ make && make install
 
编译之后文件内容:
/home/youaijj/etc
 
 
/home/youaijj/usr
 
 
/home/youaijj/var
 
Ps:var下没有cache目录,之后需要手动创建
 
 
7. Change server port
因为普通用户只能用1024以上的端口,1024以内的端口只能由root用户使用,因此需要将nginx.conf文件中的80端口改为1024以上,这里改为了8031.
...
# another virtual host using mix of IP-, name-, and port-based configuration
#
server {
listen 8031;
server_name cjj.test.dev;
access_log /home/youaijj/var/log/nginx/access.test.log; location / {
root html;
index index.html index.htm;
}
}
...
 
 
8. Start Server :
$ cd /home/youaijj/usr/sbin
$ ./nginx
如果出现如下问题:
nginx: [emerg] mkdir() "/home/youaijj/var/cache/nginx/client_temp" failed (2: No such file or directory)
手动创建文件夹,然后重新启动nginx服务即可。
 
 
9. Result test
[youaijj@youai ~]$ curl localhost:8031
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p> <p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p> <p><em>Thank you for using nginx.</em></p>
</body>
</html>
[youaijj@youai ~]$
 
或者通过浏览器访问 “服务器ip:8031:
 
附:
I. 通过浏览器访问注意检查是否开放服务器防火墙。Centos7不再使用iptables,而是使用firewall
    [root@youai nginx]# firewall-cmd --list-ports
    [root@youai nginx]# systemctl status firewalld
    [root@youai nginx]# systemctl start firewalld
    [root@youai nginx]# firewall-cmd --zone=public --add-port=8031/tcp --permanen
重启防火墙: [root@youai nginx]# systemctl restart firewalld.service
查看状态: [root@youai nginx]# firewall-cmd --list-ports
 
II. Register Nginx service into systemd as a service by create the file named nginx.service
如果不想每次手动启动,也可以将服务注册到server中,使用systemctl的方式来控制。
 
 
 

nginx部署(普通用户)的更多相关文章

  1. vue+uwsgi+nginx部署路飞学城

    vue+uwsgi+nginx部署路飞学城   有一天,老男孩的苑日天给我发来了两个神秘代码,听说是和mjj的结晶 超哥将这两个代码,放到了一个网站上,大家可以自行下载 路飞学城django代码 ht ...

  2. linux vue uwsgi nginx 部署路飞学城 安装 vue

    vue+uwsgi+nginx部署路飞学城 有一天,老男孩的苑日天给我发来了两个神秘代码,听说是和mjj的结晶 超哥将这两个代码,放到了一个网站上,大家可以自行下载 路飞学城django代码#这个代码 ...

  3. Nginx部署部分https与部分http【转】

    转自 Nginx部署部分https与部分http - na_tion的专栏 - 博客频道 - CSDN.NEThttp://blog.csdn.net/na_tion/article/details/ ...

  4. 转:在 Ubuntu 上使用 Nginx 部署 Flask 应用

    转:http://Python.jobbole.com/84286/ 原文出处: Vladik   译文出处:开源中国    我职业生涯的大部分都在使用微软的架构,最近我决定走出技术的舒适区,步入开源 ...

  5. Django + Gunicorn + Nginx 部署 Ubuntu 服务器

    Django + Gunicorn + Nginx 部署服务器 获取腾讯云 root权限 本人的服务器使用的是腾讯云,腾讯云默认是没有开放 root 用户的,我们来创建 root 用户. 创建 roo ...

  6. Flask采用Virtualenv+Supervisor+Nginx部署应用

    Flask采用Virtualenv+Supervisor+Nginx部署应用 -- 首先是概念解释 WSGI服务器,负责我们的app与服务器的交互,常用的有Gunicorn Web服务器,是个HTTP ...

  7. SpringBoot电商项目实战 — 前后端分离后的优雅部署及Nginx部署实现

    在如今的SpringBoot微服务项目中,前后端分离已成为业界标准使用方式,通过使用nginx等代理方式有效的进行解耦,并且前后端分离会为以后的大型分布式架构.弹性计算架构.微服务架构.多端化服务(多 ...

  8. Linux 集群概念 , wsgi , Nginx负载均衡实验 , 部署CRM(Django+uwsgi+nginx), 部署学城项目(vue+uwsgi+nginx)

    Linux 集群概念 , wsgi , Nginx负载均衡实验 , 部署CRM(Django+uwsgi+nginx), 部署学城项目(vue+uwsgi+nginx) 一丶集群和Nginx反向代理 ...

  9. [技术博客]nginx 部署 apt 源

    [技术博客] nginx 部署 apt 源 出于各种各样的原因, 有时需要自己配置apt源, 比如发布自己编写的debian软件包, 内网中只有一台电脑可以访问外网,或者在本地配置自己的apt源.我们 ...

  10. centosflask+uWSGI+nginx部署

    centosflask+uWSGI+nginx部署 1.      概念 Flask自带webserver--Werkzeug,可以搭建服务,运行网站.但在开发时,一般会用专业的--uWSGI. 另外 ...

随机推荐

  1. 解决brew报错:Another active Homebrew update process is already in progress

    在mac终端下执行:brew install glew结果报错: Error: Another active Homebrew update process is already in progres ...

  2. PyAlgoTrade Hello World 第一个程序(一)

    本教程的目标是快速介绍PyAlgoTrade.PyAlgoTrade的目标是帮助您实现股票交易策略.假设您有一个交易策略的想法,并且您希望使用历史数据进行评估,并查看其行为方式,那么PyAlgoTra ...

  3. [笔记]CodeIgniter的SESSION

         由于HTTP协议本身是无状态的,所以当保留某个用户的访问状态信息时,需要客户端有一个唯一标识传给服务端,这个唯一标识就是SESSION ID,存放在客户端的COOKIE中,然后服务端根据该标 ...

  4. vim自动缩进

    最近写完程序,在进行调试时发现特别困难,代码乱的一塌糊涂,特别是代码量很多时,调试起来特别囧,逻辑很难理清. 这让我想起了缩进功能,可以让代码自动对齐. gedit编辑器在菜单栏里的编辑->首选 ...

  5. JSON用法之将PHP数组转JS数组,JS如何接收PHP数组

    先看php文件,当我们获取到$arr这个数组后 foreach ($arr as $value) { $json .= json_encode($value) . ','; } echo '[' . ...

  6. HP-Mercury SiteScope安装及监控Weblogic操作

    1.Mercury SiteScope简介Mercury SiteScope是一款无代理监测解决方案,可确保分布式IT基础架构——如服务器.操作系统.网络设备.网络服务.应用和应用组件的可用性和性能. ...

  7. 【转】Windows消息投递流程:WM_COMMAND消息流程

    原文网址:http://blog.csdn.net/hyhnoproblem/article/details/6182585 该示例通过研究基本的单文档程序的“文件”--“打开”命令,分析WM_COM ...

  8. CentOS 6.5 下搭建NTP服务器

    参考网站: http://www.iyunv.com/thread-64847-1-1.html http://acooly.iteye.com/blog/1993484 1         检查系统 ...

  9. 分类预测输出precision,recall,accuracy,auc和tp,tn,fp,fn矩阵

    此次我做的实验是二分类问题,输出precision,recall,accuracy,auc # -*- coding: utf-8 -*- #from sklearn.neighbors import ...

  10. ASP.NET Web Pages

    ylbtech-.Net-ASP.NET Web Pages: 1.返回顶部   2.返回顶部   3.返回顶部   4.返回顶部   5.返回顶部     6.返回顶部   7.返回顶部   8.返 ...