Home  >  Article  >  Backend Development  >  nginx sets dynamic and static separation

nginx sets dynamic and static separation

WBOY
WBOYOriginal
2016-07-29 09:14:461095browse

nginx configure dynamic and static separation
Install jdk
rpm -ivh jdk-7u79-linux-x64.rpm
Set jdk environment variables
vim /etc/profile
JAVA_HOME="/usr/java/jdk1.7.0_79"
CLASS_PATH="$ JAVA_HOME/lib:$JAVA_HOME/jre/lib"
PATH=".:$PATH:$JAVA_HOME/bin "
CATALINA_HOME="/usr/local/tomcat"
export JAVA_HOME CATALINA_HOME
Install tomcat
tar xvf apache-tomcat- 7.0.64.tar.gz -C /usr/local/
cd apache-tomcat-7.0.64.tar.gz
ln -s apache-tomcat-7.0.64 tomcat
Modification log
vim /usr/local/tomcat /conf/server.xml
The modification log is as follows
prefix="localhost_access_log." suffix=".txt"
                pattern="%{x-forwarded-for}i %l %u %t "%r" %s % b" />
Start tomcat
cd /usr/local/tomcat/bin/; ./shutdown.sh
;./startup.sh

nginx installation
tar xvf nginx-1.4.7.tar cd
nginx-1.4.7.gz -C /usr/local/
You need to install pcre first
./configure --prefix=/usr/local/nginx --with-http_gzip_static_module --with-http_stub_status_module --with-pcre=/ root/pcre-8.37
Create nginx account
useradd nginx -s /sbin/nologin
cd /usr/local/nginx;
mkdir vhosts.d
touch proxy.conf write
#!nginx (-)
# proxy. conf
proxy_redirect off;
proxy_set_header   Host $host;
proxy_set_header              ed_for; #Get the agent’s
real ip
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_b uffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE -HOST $remote_addr;
proxy_set_header
# server localhost:80;
}
server {
listen 80;
server_name localhost;
root /data/www/web; #Directory 777, file 644 permissions
index index.shtml index.html index.htm;#Required Write it all, otherwise a 403 error will appear
location / {
  root /data/www/web;
  index index.shtml index.html index.htm;
  proxy_set_header  /local/nginx/conf/proxy.conf;
}
location ~ .*.jsp$ #All jsp pages are processed by tomcat
{
  index index.jsp;
  proxy_pass http://localhost:8080;# Turn to tomcat for processing
include /usr/local/nginx/conf/proxy.conf;
# proxy_set_header
The above introduces the setting of dynamic and static separation in nginx, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:ip2long-long2ipNext article:ip2long-long2ip