LoginSignup
5
8

More than 5 years have passed since last update.

Nginxで躓いたところ及びメモ

Last updated at Posted at 2017-01-12

さくらVPSにNginxをいれたらいろんな問題が起ったり、メモしたいことがあったのでメモ。

ホームディレクトリにシンボリックリンクをはると「403 Forbidden」

アクセスするディレクトリにホームディレクトリからシンボリックリンクをはったものを適応させると「403 Forbidden」が出た。
default.confにも問題ないし、シンボリックリンクやホームディレクトリにおいてあるソースディレクトリにchownしてもchmodしてもだめ。

解決法

/home/userディレクトリ自体のパーミッションを変えるとOK。

chmod 755 /home/user

phpMyAdminにログインできない

phpmyadminで以下のエラー

Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly.

解決法

大抵、php.iniの「session.save_path」で指定しているのディレクトリのパーミッションの問題。

sudo chown nginx:nginx /var/lib/php/session

nginxでwordpressのパーマリンクをデフォルト以外に対応する

WPとかでパーマリンクデフォルトのやつ使ってない時は以下のように対応
nginxでwordpressのパーマリンクをデフォルト以外に対応する

そもそもVPSにNginx入れるとき

さくらVPSにnginx/PHP/MySQLをインストールする手順

よく使うNginxにまつわるコマンド

  • 設定ファイルをいじる sudo vi /etc/nginx/conf/***.conf
  • 起動 sudo service nginx start
  • 再起動 sudo service nginx restart
  • コンフィグテスト sudo /etc/init.d/nginx configtest
5
8
1

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
5
8