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

cd /usr/soft/nginx-1.8.1

./configure --prefix=/usr/soft/nginx --with-http_stub_status_module --with-http_ssl_module
报错缺少pcre

安装pcre
apt-get install libpcre3 libpcre3-dev

./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

你可能感兴趣的:(nginx配置安装、跳转到tomcat)