linux 에서 nginx + java + php 환경 설정

4300 단어
1. 목표 설정
1. lnmp 를 통 해 기초 환경의 설 치 를 완성 합 니 다.
lnmp 를 통 해 설치 한 후 관련 소프트웨어 의 위 치 는 공식 설명 을 참고 하 시기 바 랍 니 다.설치 후 나 는 단독으로 가스 공식 설명 을 통 해 nginx 버 전 을 업그레이드 했다.
2. nginx 를 설정 하여 phop + 자바 환경 이 한 기계 에서 의 재 활용 을 만족 시 킬 수 있 도록 합 니 다.
2. 관련 설치 설명
1. tomcat 를 / usr / local / tomcat 6 2 에 설치 하고 nginx 를 / usr / local / nginx 3 에 설치 하 며 자바 프로젝트 를 tomcat 6 / webapps 에 설치 합 니 다.
4. phop 관련 항목 을 / usr / local / 아래 에 직접 설치 합 니 다.
3. 관련 설정 설명
주로 몇 개의 메 인 프로필 의 상황 을 설명 합 니 다.
1、nginx.conf
user  www www;

worker_processes 1;

error_log  /home/wwwlogs/nginx_error.log  crit;

pid        /usr/local/nginx/logs/nginx.pid;

#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 51200;

events
	{
		use epoll;
		worker_connections 51200;
	}
#fastcgi        。       
http
	{
		include       mime.types;
		default_type  application/octet-stream;

		server_names_hash_bucket_size 128;
		client_header_buffer_size 32k;
		large_client_header_buffers 4 32k;
		client_max_body_size 50m;

		sendfile on;
		tcp_nopush     on;

		keepalive_timeout 60;

		tcp_nodelay on;

		fastcgi_connect_timeout 300;
		fastcgi_send_timeout 300;
		fastcgi_read_timeout 300;
		fastcgi_buffer_size 256k;
		fastcgi_buffers 8 256k;
		fastcgi_busy_buffers_size 512k;
		fastcgi_temp_file_write_size 512k;

		gzip on;
		gzip_min_length  1k;
		gzip_buffers     4 16k;
		gzip_http_version 1.0;
		gzip_comp_level 2;
		gzip_types       text/plain application/x-javascript text/css application/xml;
		gzip_vary on;

		#limit_zone  crawler  $binary_remote_addr  10m;

		#log format
		log_format  access  '$remote_addr - $remote_user [$time_local] "$request" '
             '$status $body_bytes_sent "$http_referer" '
             '"$http_user_agent" $http_x_forwarded_for';

#                , nginx/conf/vhost   
 include vhost/*.conf;



}

2. vhost (nginx. conf 에서 도 메 인 이름 에 대응 하 는 프로필 위 치 를 가리 키 고 있 습 니 다)
(1), php 프로젝트 설정: 파일 이름 shequ. imudges. com. conf
도 메 인 이름 에 대한 설정 을 보 여 드 리 겠 습 니 다: join. imudges. com
server
        {
                listen      80;
                server_name join.imudges.com;
                index index.html index.htm index.php;
                root  /usr/local/discuzx/upload;

                location ~ .*\.(php|php5)?$
                        {
                                try_files $uri =404;
                                fastcgi_pass  unix:/tmp/php-cgi.sock;
                                fastcgi_index index.php;
                                include fcgi.conf;
                        }

                location /status {
                        stub_status on;
                        access_log   off;
                }

                location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
                        {
                                expires      30d;
                        }

                location ~ .*\.(js|css)?$
                        {
                                expires      12h;
                        }

                access_log  /home/wwwlogs/access.log  access;
        }

(2) 자바 프로젝트 설정: 파일 이름 www. imudges. com. conf
여기 자바 프로젝트 설정 을 지정 하 였 습 니 다.  www.imudges.com
    server {  
        listen       80;  
        server_name  www.imudges.com; 
  
        #charset koi8-r;  
  
        access_log  logs/dev/null;  
  
    root   /usr/local/tomcat6/webapps/quickbook/;  
 
#        tomcat       

 location / {  
              
             index   index.jsp index.html index.htm ;  
  
             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_buffers           32 4k;  
             proxy_connect_timeout   3;    
             proxy_send_timeout      30;    
             proxy_read_timeout      30;    
             proxy_pass http://127.0.0.1:8080;  
        }

}

소스 네트워크

좋은 웹페이지 즐겨찾기