>  기사  >  백엔드 개발  >  CentOS6 시스템의 Yii/Yii2/Nginx/PHP-FPM 구성 예

CentOS6 시스템의 Yii/Yii2/Nginx/PHP-FPM 구성 예

WBOY
WBOY원래의
2016-08-08 09:28:01975검색

Yii 애플리케이션 Apache의 구성은 비교적 간단합니다. nginx 구성은 주로 단일 항목 파일의 문제를 처리해야 하며 이는 Apache 구성의 다음 문장에 해당합니다.

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
을 번역해야 합니다. 해당 Nginx 명령어에 추가합니다. 예는 다음과 같습니다:

server {
    listen 80;
    server_name www.techbrood.com;
    access_log logs/techbrood.access.log;

    root /var/www/html/techbrood/web;

    location / {
        index index.php;
        if (!-e $request_filename){
          rewrite ^/(.*) /index.php last;
        }
    }
    location ~ \.php(?|$) {
        #fastcgi(php-fpm) listening on 127.0.0.1:9000
        root /var/www/html/techbrood/web;
        #your path to fastcgi_params file
        include /etc/nginx/conf/fastcgi_params; 
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass 127.0.0.1:9000;
        #fastcgi_pass unix: /var/run/php-fpm.sock
    }

    location ~ \.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$ {
        root /var/www/html/techbrood/web;
    }
}

by iefreer

위 내용은 관련 내용을 포함하여 CentOS6 시스템의 Yii/Yii2/Nginx/PHP-FPM 구성 예제를 소개합니다. PHP 튜토리얼에 관심이 있는 친구들에게 도움이 되기를 바랍니다.

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.