Install Nginx reverse Proxy on OpenShift (failed record)

Source: Internet
Author: User
Tags nginx reverse proxy

1. Install OpenShift RHC on-premises (rails integrated with Ruby)

2, register the account in OpenShift, record the SSH

3. Go to local "Command Prompt with Ruby and Rails"

RHC app create MySite diy-0.1rhc app Show-a MySite

4, using PUTTY,SSH connection MySite (SSH @mysite. rhcloud.com)

5. Installing Nginx and Pcre plug-in

cd  $OPENSHIFT _tmp_dirwget http://nginx.org/download/nginx-1.2.2.tar.gz  #下载参考Nginx官网tar  zxf  nginx-1.2.2.tar.gzwget tar jxf pcre-8.36.tar.bz2 cd nginx-1.2.2./configure  --prefix= $OPENSHIFT _data_dir --with-pcre= $OPENSHIFT _tmp_dir/pcre-8.36 If you can see the text, the configuration is normal, and then you can continue. Configuration summary+ using pcre library: /tmp//pcre-8.31+ openssl library  is not used+ md5: using system crypto library+ sha1: using  system crypto library+ using system zlib librarynginx path  prefix:  "/var/lib/stickshift/c45cdc9a27944dc5b1cd7cb9e5c9f8c7/mysite/runtime/" nginx file:  "/var /lib/stickshift/c45cdc9a27944dc5b1cd7cb9e5c9f8c7/mysite/runtime//sbin/nginx "nginx configuration  prefix:  "/var/lib/stickshift/c45cdc9a27944dc5b1cd7cb9e5c9f8c7/mysite/runtime//conf" nginx  configuration file:  "/var/lib/stickshift/c45cdc9a27944dc5b1cd7cb9e5c9f8c7/mysite/runtime//conf/nginx.conf "nginx pid file: "/ Var/lib/stickshift/c45cdc9a27944dc5b1cd7cb9e5c9f8c7/mysite/runtime//logs/nginx.pid "Nginx error log  file:  "/var/lib/stickshift/c45cdc9a27944dc5b1cd7cb9e5c9f8c7/mysite/runtime//logs/error.log" Nginx  http access log file:  "/var/lib/stickshift/c45cdc9a27944dc5b1cd7cb9e5c9f8c7/mysite/ Runtime//logs/access.log "nginx http client request body temporary files: " Client_body_temp "nginx http proxy temporary files: " Proxy_temp "nginx http  fastcgi temporary files:  "Fastcgi_temp" Nginx http uwsgi temporary files:   "Uwsgi_temp" nginx http scgi temporary files:  "Scgi_temp" make install  (Long time, SSH will break, do not know make install&  command can not) vi  $OPENSHIFT _data_dir/conf/nginx.conf to post a configuration I'm using #user  nobody;worker_processes 1; #error_log  logs/error.log; #error_log  logs/error.log notice; #error_log  logs /error.log info; #pid  logs/nginx.pid;events {worker_connections 1024;} http {include mime.types;default_type application/octet-stream; #log_format  main  ' $ remote_addr –  $remote _user [$time _local]  "$request"   ' #  ' $status   $body _bytes _sent  "$http _referer"   ' #  ' "$http _user_agent"   "$http _x_forwarded_for"; #access_log   logs/access.log main;sendfile on; #tcp_nopush  on; #keepalive_timeout  0;keepalive_timeout  65; #gzip  on;upstraem name{ server ip:80 max_files=3; server ip:80  max_files=3; server ip:80 max_files=3; server ip:80 max_files=3;  server ip:80 max_files=3; server ip:80 max_files=3; }server {listen  OPENSHIFT_IP: $OPENSHIFT _port;//When the app starts, use the. openshift/Action_hooks/start, execute the command, replacing the IP and port variables in the environment variable with OpenShift in env server_name localhost;location / { proxy_redirect http://www.googlecom/;p roxy_cookie_domain.com mystie.rhcloud.com;//Here, please replace your domain name Proxy_ pass  upstream name;proxy_set_header accept-encoding  "";p roxy_set_header  x-real-ip  $remote _addr;proxy_set_header x-forwarded-for  $proxy _add_x_forwarded_for;proxy_set_ Header x-forwarded-proto https;}}} After you save this file, you need to perform mv  $OPENSHIFT _data_dir/conf/nginx.conf  $OPENSHIFT _data_dir/conf/nginx.conf.template This step is important , if you do not save git clone  ssh://[email protected]/~/git/nginx.git/local C drive will be more than one site folder into the local "Command  prompt with ruby and rails "Rhc setupcd mysite (nginx) vi .openshift/ action_hooks/start#!/bin/bash# the logic to start up your application  Should be put in this# script. the application will work only if it binds to#  $OPENSHIFT _internal_ip:8080# nohup $ openshift_repo_dir/diy/testrubyserver.rb  $OPENSHIFT _internal_ip  $OPENSHIFT _repo_dir/diy >   $OPENSHIFT _diy_log_dir/server.log 2>&1 &# replace the  $OPENSHIFT _ internal_ip and  $OPENSHIFT _internal_port before starting up the serversed  -e  "s/' echo  ' $OPENSHIFT _ip: $OPENSHIFT _port '/' echo  $OPENSHIFT _diy_ip: $OPENSHIFT _diy_port ' /"  $OPENSHIFT _data_dir/conf/nginx.conf.template >  $OPENSHIFT _data_dir/conf/nginx.confnohup   $OPENSHIFT _data_dir/sbin/nginx >  $OPENSHIFT _diy_log_dir/server.log 2>&1  & Last Send command git commit -a -m  "start nginx when starting up the  app "Git push well. The configuration is done. If you have any problems during the configuration process, you can perform rhc tail -a mysite view log

Reference:

1, OpenShift install Nginx and reverse proxy Google

2, Nginx reverse bound domain name method and detailed operation application example: Google and Gravatar

3, Running Nginx on OpenShift

4, Nginx, PHP5.5 and Phalcon on OpenShift

5. Install Nginx in OpenShift

6. Git clone

This article is from the "HCLHDJ" blog, make sure to keep this source http://353721.blog.51cto.com/343721/1660257

Install Nginx reverse Proxy on OpenShift (failed record)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.