nginx配置安裝、跳轉到tomcat

下載unbuntu14.04 - 安裝系統 - 配置網絡(參考博文)
apt-get update
apt-get install
apt-get install vim

apt-get install ssh        發現報錯
解決報錯,先執行apt-get -f install
而後執行,apt-get install ssh順利安裝

安裝jdk
cd usr
mkdir soft

上傳jdk到/usr/soft
解壓:tar -zxvf jdk.tar.gz
建立軟鏈接:ln -s /jdk1.7 jdk

vi /etc/profile
JAVA_HOME=/usr/jdk
CLASSPATH=$JAVA_HOME/lib
PATH=$PATH:$JAVA_HOME/bin

export JAVA_HOME CLASSPATH PATH

source /ect/profile
java -version
html


下載nginx-1.8.1.tar.gz
http://nginx.org/en/download.html
java


cd /usr
mkdir soft
cd soft
mkdir nginx
上傳nginx-1.8.1.tar.gz到/usr/soft/
解壓:tar -zxvf nginx-1.8.1.tar.gz
cd /usr/soft/nginx-1.8.1

./configure --prefix=/usr/soft/nginx --with-http_stub_status_module --with-http_ssl_module
報錯缺乏pcre

安裝pcre
unbuntu    apt-get install libpcre3 libpcre3-devnginx

centos    yum install pcre、    yum -y install pcre-develweb


./configure --prefix=/usr/soft/nginx --with-http_stub_status_module --with-http_ssl_module
報錯缺乏openssl

安裝openssl
檢查是否已安裝openssl:

sudo apt-get install openssl

若是已安裝執行如下操做:
sudo apt-get install libssl-dev
sudo apt-get install libssl0.9.8

./configure --prefix=/usr/soft/nginx --with-http_stub_status_module --with-http_ssl_module
make
make install

cd /usr/soft/nginx/sbin
./nginx

訪問:http://192.168.191.231:80,出現nginx歡迎頁面

中止
./nginx -s stop

設置訪問nginx,跳轉到tomcat
cd /usr/soft/nginx/conf
vi nginx.conf
upstream sniper.com {
        #ip_hash;
        server 192.168.191.231:8080 weight=3;
    }

    server {
        listen       80;
        server_name  localhost;

        charset UTF-8;   
        index index.html index.htm index.jsp index.do;
        root /usr/soft/apache-tomcat-7.0.8/webapps/ROOT;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location ~ ^/(WEB-INF)/ {
          deny all;
        }
    
        location ~ .*\.(jsp|jspx|do)?$ {
                proxy_pass http://sniper.com;
                proxy_set_header  X-Real-IP $remote_addr;
                proxy_next_upstream http_502 http_504 error timeout invalid_header;
        }

訪問:http://192.168.191.231:80,跳轉到192.168.191.231:8080

apache

相關文章
相關標籤/搜索