목요일, 6월 13, 2024
HomeLinuxubuntu 16.04 nginx php7 install

ubuntu 16.04 nginx php7 install

ubuntu 16.04 nginx php7 install

nginx php7 install

apt-get install nginx
apt-get install php7.0-fpm php7.0-gd php7.0-curl php7.0-mbstring php7.0-xml php7.0-mcrypt php7.0-mysql

php.ini edit

vi /etc/php/7.0/fpm/php.ini
max_execution_time = 600
max_input_time = 600
memory_limit = 2048M
post_max_size = 2048M
upload_max_filesize = 2048M

vi /etc/php/7.0/cli/php.ini
max_execution_time = 600
max_input_time = 600
memory_limit = 2048M
post_max_size = 2048M
upload_max_filesize = 2048M

nginx.conf

 user                            www-data www-data;
    
    worker_processes                2;
    worker_rlimit_nofile            100000;
    
    error_log                       /var/log/nginx/error_pipe99       debug;
    pid                 	    /run/nginx.pid;

    events {
            worker_connections      1024;
            accept_mutex_delay      100ms;
            multi_accept            on;
            use epoll;
    }
    
    
    http {
            #--------------------------------------------------------------------------#
            #--- default --------------------------------------------------------------#
            #--------------------------------------------------------------------------#
            include                 mime.types;
   
	    gzip on;
	    gzip_proxied any;
	    gzip_types text/plain text/xml text/css image/svg+xml application/javascript application/x-javascript;
	    gzip_vary on;
	    gzip_disable "MSIE [1-6]\.(?!.*SV1)";

 
            sendfile                on;
            tcp_nopush              on;
            tcp_nodelay             on;
            keepalive_timeout       30; 
            keepalive_requests      100000;
            send_timeout            2;
            server_tokens           off;
            server_name_in_redirect off;
     
            default_type            application/octet-stream;
            index                   index.html
    
            #--------------------------------------------------------------------------#
            #--- time -----------------------------------------------------------------#
            #--------------------------------------------------------------------------#
            client_body_timeout     10;
            client_header_timeout   10;
    
            #--------------------------------------------------------------------------#
            #--- proxy ----------------------------------------------------------------#
            #--------------------------------------------------------------------------#
            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   300;
            proxy_send_timeout      120;
            proxy_read_timeout      300;
            proxy_buffers           32 32k;
            fastcgi_buffer_size     64k;
            fastcgi_buffers         4 64k;
            proxy_ignore_client_abort on;

            proxy_cache_path        /var/log/nginx/cache/one 
                                    levels=1:2
                                    keys_zone=one:10m
                                    max_size=1500m
                                    inactive=600m; 
            proxy_cache_key         "$scheme$host$request_uri";
            proxy_temp_path         /var/log/nginx/cache/tmp;
    
            #--------------------------------------------------------------------------#
            #--- log ------------------------------------------------------------------#
            #--------------------------------------------------------------------------#
            log_format      comm-lf         '$remote_addr [$remote_port] - $remote_user [$time_local-$msec]  $status '
                                            '"$request" $request_time $body_bytes_sent "$http_referer" '
                                            '"$http_user_agent" "$http_x_forwarded_for"';
            log_format      static-lf       '$remote_addr [$time_local] '
                                            '"$request" &staus $body_bytes_sent "$http_user_agent"';
            log_format      error-lf        '$remote_addr - $remote_user [$time_local-$msec]  $status '
                                            '"$request" $request_time $status "$http_user_agent" "$http_x_forwarded_for"';
   
            #--------------------------------------------------------------------------#
            #--- - http ---------------------------------------------------------------#
            #--------------------------------------------------------------------------#
            include /etc/nginx/sites-enabled/*;
    
    }

/etc/nginx/sites-enabled/default

server {
	listen 80;

	root /var/html/wordpress;
	index index.html index.htm index.php;

        error_log   /var/log/nginx/pipe/error_pipe11        error;
        access_log  /var/log/nginx/pipe/access_pipe11       comm-lf;

	client_max_body_size    2048m;

	server_name localhost;

	location = /favicon.ico {
		log_not_found off;
		access_log off;
	}

	location = /robots.txt {
		allow all;
		log_not_found off;
		access_log off;
	}

        location / {
		client_max_body_size    2048m;
                try_files $uri $uri/ /index.php?$args;
        }

 	location ~ [^/]\.php(/|$) {
		fastcgi_split_path_info ^(.+?\.php)(/.*)$;
		if (!-f $document_root$fastcgi_script_name) {
			return 404;
		}	
		try_files $uri =404;
		 fastcgi_split_path_info ^(.+\.php)(/.+)$;
        	fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
	 	fastcgi_index index.php;
        	include fastcgi.conf;
    	}
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Time limit exceeded. Please complete the captcha once again.

Most Popular