LoginSignup
4
4

More than 5 years have passed since last update.

nginx+fuelPHP でaliasを切りwordpress等同居させる

Last updated at Posted at 2016-04-07

はじめに

nginx に fuelPHPとwordpressを同居させる為に準備した時のメモです。
既にnginx+fuelPHPの環境が整っていることを前提にaliasを設定しaliasの先にwordpressをいれればOKかと考えてます。

環境
nginx
php-fpm
fuelPHP 1.7

詳細

  1. aliasの設定

wordpressのインストール先のフォルダを作成します。
/usr/local/src/xxxxx

nginxのコンフィグに作成したフォルダのaliasを切ります。

xxx.conf
    location /column {
        alias /usr/local/src/xxxxx;
        index index.php;
        if (!-e $request_filename) {
            rewrite ^/xxxxx(.+)$ /column/index.php?q=$1 last;
            break;
        }
    }
    location ~ ^/xxxxx/.+\.php$ {
        fastcgi_pass            unix:/var/run/php-fpm/php-fpm.sock;
                fastcgi_index           index.php;
        fastcgi_split_path_info ^/xxxxx(.+\.php)(.*)$;
                include                 fastcgi_params;
        fastcgi_param           SCRIPT_FILENAME /usr/local/src/xxxxx$fastcgi_script_name;
    }
#--- ここからはFuelPHP用 
    location / {
        index               index.php;
        try_files $uri      $uri/ /index.php$is_args$args;
    }

    location ~ \.php$ {
        fastcgi_pass        unix:/var/run/php-fpm/php-fpm.sock;
        fastcgi_index       index.php;
        include             fastcgi_params;
        fastcgi_param       SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

あとはnginxを再起動します。

/usr/local/src/xxxxxにコンテンツを入れれば動くと思います。

その他

参考
nginx+php-fpmをyumでインストールして、WordPress/CakePHPを動かす設定

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4