【linux】让服务器支持php 和java在nginx 服务器的共存

1 让服务器安装

   oneinstack-full.tar.gz

安装全能环境这里省去不写,可以参照百度

2 接着服务器nginx 的配置文件如下 

 server {

    listen 80;
    server_name _;
    access_log /data/wwwlogs/access_nginx.log combined;
    root /data/wwwroot/default;
    index index.html index.htm index.php;
    location /nginx_status {
        stub_status on;
        access_log off;
        allow 127.0.0.1;
        deny all;
        }
    location ~ (\.jsp)|(\.do)$ {  
         proxy_pass http://yourdomainIP:8080;  
         proxy_redirect off;  
         proxy_set_header Host $host;  
         proxy_set_header X-Real-IP $remote_addr;  
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;  
         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_buffers_size 64k;  
         proxy_temp_file_write_size 64k;  
    }  
    location ~ [^/]\.php(/|$) {
        #fastcgi_pass remote_php_ip:9000;
        fastcgi_pass unix:/dev/shm/php-cgi.sock;
        fastcgi_index index.php;
        include fastcgi.conf;
        }
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ {
        expires 30d;
        access_log off;
        }
    location ~ .*\.(js|css)?$ {
        expires 7d;
        access_log off;
        }
    }


########################## vhost #############################
    include vhost/*.conf;
}

你可能感兴趣的:(linux)