본문으로 바로가기

워드프레스를 위한 엔진엑스 환경설정의 간단한 예입니다.

워드프레스 설정

server {
  listen    80;
  server_name    blog.uzuro.com
  root    /var/www/blog.uzuro.com/public_html;

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

  # 워드프레스를 서브폴더를 이용해서 서비스하는 경우에 추가
  location /wordpress/ {
    try_files $uri $uri/ /wordpress/index.php?$args;
  }

  location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {

    # 정적 파일에 대한 몇가지 기본적인 캐쉬 제어
    expires max;
    add_header Pragma public;
    add_header Cache-Control "public, must-revalidate, proxy-revalidate"; 
  }

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

  error_page 404 /404.html;
  error_page 500 502 503 504 /50x.html;

  location = /50x.html {
    root /usr/local/nginx/www;
  }

  location ~ \.php$ {
    try_file $uri =404;
  }