RHEL 6.4 安装 nginx+uWSGI+python+bottle +远程连接oracle10g

最近一个微信的后台需要,迁移服务器,之前是在Ubuntu12.04上搭了一套。现在要迁到他们公司内部,说是为了安全、统一管理方便,确实能节约成本,提高管理效率,不知道其他大点的公司也是不是这种机制。

给的系统是RHEL6.4,一下子换到这类型的linux系统还有点不习惯,不过也不难,用用就习惯了。

不过,让人最恶心的是,这机子在内网上,并且是通过web统一管理系统登录上去了,各种权限没有,得走流程一步步申请,各种恶心。

下面就是安装过程了。

一、nginx1.62 稳定版

http://nginx.org/en/download.html 

下载 nginx-1.6.2.tar.gz

或者 
wget http://nginx.org/download/nginx-1.6.2.tar.gz 
tar -zxvf  nginx-1.6.2.tar.gz
cd  nginx-1.6.2
./configure --sbin-path=/usr/local/sbin/nginx


 
 
configure 支持下面的选项: --prefix=<path> - Nginx安装路径。如果没有指定,默认为 /usr/local/nginx。  --sbin-path=<path> - Nginx可执行文件安装路径。只能安装时指定,如果没有指定,默认为<prefix>/sbin/nginx。  --conf-path=<path> - 在没有给定-c选项下默认的nginx.conf的路径。如果没有指定,默认为<prefix>/conf/nginx.conf。  --pid-path=<path> - 在nginx.conf中没有指定pid指令的情况下,默认的nginx.pid的路径。如果没有指定,默认为 <prefix>/logs/nginx.pid。  --lock-path=<path> - nginx.lock文件的路径。  --error-log-path=<path> - 在nginx.conf中没有指定error_log指令的情况下,默认的错误日志的路径。如果没有指定,默认为 <prefix>/logs/error.log。  --http-log-path=<path> - 在nginx.conf中没有指定access_log指令的情况下,默认的访问日志的路径。如果没有指定,默认为 <prefix>/logs/access.log。  --user=<user> - 在nginx.conf中没有指定user指令的情况下,默认的nginx使用的用户。如果没有指定,默认为 nobody。  --group=<group> - 在nginx.conf中没有指定user指令的情况下,默认的nginx使用的组。如果没有指定,默认为 nobody。  --builddir=DIR - 指定编译的目录  --with-rtsig_module - 启用 rtsig 模块

安装Nginx时报错

./configure: error: the HTTP rewrite module requires the PCRE library.

需要安装相应的包

yum -y install pcre-devel openssl openssl-devel
./configure --sbin-path=/usr/local/sbin/nginx
make
make install

安装完成

但是,每次stop|start都需要 带上路径,下面把nginx配置成服务

初始化脚本(用于启动、停止、查看状态)

当你使用源码编译安装Nginx的时候,管理Nginx非常的不方便,比如启动Nginx的命令就很长,这就需要一个初始化脚本来实现诸如使用servicenginx start就可以启动Nginx。下面我们来一步步配置安装。

  1. wget http://www.centos.bz/wp-content/uploads/2011/07/nginx
  2. mv nginx /etc/rc.d/init.d/
  3. chmod 755 /etc/rc.d/init.d/nginx
  4. /etc/rc.d/init.d/nginx status

脚本执行出现/bin/sh^M: bad interpreter错误提示

这是由于此文件是在Window下编写的,换行跟linux中不一样导致。

vim /etc/rc.d/init.d/nginx 

……脚本内容省略……

:set ff

fileformat=doc

然后执行:set ff=unix

……脚本内容省略……

:set ff=unix

/etc/rc.d/init.d/nginx status
显示正在运行......

现在把Nginx加入chkconfig,并设置开机启动。

  1. chkconfig --add nginx
  2. chkconfig nginx on

启动、停止,查看状态的命令如下:

  1. service nginx start
  2. service nginx stop
  3. service nginx status


nginx配置
cd /usr/local/conf/nginx/


 
 
server {
        listen       80 default;
        server_name  localhost;
        root /srv/http/static;
        #charset koi8-r;
 
        #access_log  logs/host.access.log  main;
 
        location / {
          root   html;
            index  index.html index.htm;
        }
location /wx {                include uwsgi_params;                 uwsgi_pass 127.0.0.1:9098;
        } ##用来把请求转发到uwsgi
....................
}
如上红色加粗显示部分,做三处修改。
执行 nginx -t 测试刚才的nginx配置文件是否有语法错误:
 
[root@fsvps nginx]# nginx -t
nginx: the configuration file /usr/local/conf/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/conf/nginx/nginx.conf test is successful   二、安装uwsgi(如果python是2.6的,建议先升级到2.7 http://m.oschina.net/blog/210486
wget http://projects.unbit.it/downloads/uwsgi-1.4.2.tar.gz
    tar -zxvf uwsgi-1.4.2.tar.gz cd uwsgi-1.4.2
    python setup.py build
    make
    mv uwsgi /usr/bin		//将编译好的文件移动到此处

 三、安装bottle四、安装 cx_orcale

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值