LoginSignup
0
0

More than 5 years have passed since last update.

サブディレクトリに設置したfuelphpにアクセスできるようにNginxを設定する

Posted at

http://example.com/subdirにアクセスした時に、/var/www/html/subdirに設置したfuelphpを動かせるようにしたいと思った時のメモ。

   server {
       listen       80 default_server;
       access_log   /var/log/nginx/development.access.log;
       index     index.php index.html;

       # main
       location / {
            root      /var/www/html/;
            try_files $uri $uri/ /index.php;
       }

       # sub
       location ^~ /subdir {
            alias     /var/www/html/subdir/public;
            try_files $uri $uri/ /index.php;

            if (!-e $request_filename) { rewrite ^ /subdir/index.php last; }

            location ~ \.php$ {
                if (!-f $request_filename) { return 404; }
                fastcgi_pass 127.0.0.1:9000;
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $request_filename;
            }
        }
   }
0
0
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
0
0