LoginSignup
0
0

More than 5 years have passed since last update.

nginxで永遠に特定のページにリダイレクト

Posted at

rootにリダイレクトさせたいパス、indexにファイル名を記入する

server {
    listen 80;
    server_name example.com;
    index index.php;
    error_log /path/to/example.error.log;
    access_log /path/to/example.access.log;
    root /path/to/public;

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

    location ~ \.php {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param SCRIPT_NAME $fastcgi_script_name;
        fastcgi_index index.php;
        fastcgi_pass 127.0.0.1:9000;
    }
}

出たエラー

  • 502エラー

    • fastcgi_passがうまく通ってなかった
  • dockerでnginx(webサーバ)が立ち上がらない

    • エラーログ、アクセスログのパスが間違っている
    • Httpディレクティブ内にserverディレクティブが入っていない

うまく立ち上がらないとき

docker環境下で、何が原因かわからないが、立ち上がらないときは
docker-compose up --build
で、監視する

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