标签:Nginx Tomcat Java Linux JDK
一. JDK安装下载jdk和tomcat(一般tomcat版本要和jdk对应,及tomcat7对应jdk1.7) mkdir /usr/java tar xf jdk1.7.0_75.tar.gz -C /usr/java/ 然后在/etc/profile中添加如下内容: export JAVA_HOME=/usr/java/jdk1.7.0_75 export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOMR/bin . /etc/profile
二.Tomcat安装
tar xf apache-tomcat-7.0.85.tar.gz mv apache-tomcat-7.0.85 /usr/local/tomcat /usr/local/tomcat/bin/startup.sh #启动tomcat,启动成功后会有三个端口启动8009,8080,8005
三.配置Nginx代理Tomcat
upstream web1{ server 127.0.0.1:8080 weight=1 max_fails=2 fail_timeout=30s; } server { listen 80; server_name xxx域名; index index.jsp index.html index.htm; root /data/webapps/www; location / { proxy_next_upstream http_502 http_504 error timeout invalid_header; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://web1; } }
以上步骤后完成配置,可以通过浏览器访问测试了。
标签:Nginx Tomcat Java Linux JDK
原文地址:http://blog.51cto.com/vaedit/2121559