Home CentOS7 nginx maxai.conf 완벽 설정

nginx maxai.conf 완벽 설정

by maxblog
0 comment

nginx conf 파일을 만들어오면서 많은 오류들을 접했다.
다음은 maxai 홈페이지의 conf를 완벽하게 전혀 문제없게 설정해놓은 소스이다. 😀
여기까지 오는데 오랜시간이 걸렸다…ㅋ…🤔

server {
	listen       80;
	server_name maxai.kr www.maxai.kr;
	return 301 https://$host$request_uri;
}




server {

	listen       443 ssl;
	server_name maxai.kr www.maxai.kr;

	ssl_certificate /etc/letsencrypt/live/maxai.kr/fullchain.pem;
	ssl_certificate_key /etc/letsencrypt/live/maxai.kr/privkey.pem; 

	root   /maxwww/maxai.kr;
	index index.php index.html index.htm;
   


	try_files $uri $uri/ /index.php?q=$uri&$args; 
    
    
	location ~ /wp-content/(?<path>.+)\.(?<ext>jpe?g|png|gif)$ {
        if ($http_accept !~* "image/webp") {
            break;
	}
	add_header Vary Accept;
	add_header Cache-Control "private" always;
	expires 365d;
	try_files /wp-content/uploads-webpc/$path.$ext.webp $uri =404;
	}
    

	location ~ \.php$ {

	try_files $uri =404;
	fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
	fastcgi_index index.php;
	fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
	include fastcgi_params;
	fastcgi_read_timeout 300;
	}
    

	location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
	expires 1M;
	access_log off;
	add_header Cache-Control "public";
	}


	location ~* \.(?:css|js)$ {
	expires 1y;
	access_log off;
	add_header Cache-Control "public";
	}


	# xmlrpc.php 막기
	location = /xmlrpc.php {
	deny all;
	}


}





좋아할만한 추천 글

Leave a Comment

Soledad is the Best Newspaper and Magazine WordPress Theme with tons of options and demos ready to import. This theme is perfect for blogs and excellent for online stores, news, magazine or review sites.

Buy Soledad now!

Edtior's Picks

Latest Articles

ⓒ 2023.  FUNCOM all rights reserved.