Nginx

Nginx + PHP-FPM で WordPress を動かす

Nginx + PHP-FPM で WordPress を動かしてみました。 環境 CentOS 6.6 Remiリポジトリの追加 以下のページ通りにRemiリポジトリとEPELリポジトリを追加しておきます。 (Remiリポジトリを利用するにはEPELリポジトリが必要) 【Linux】EPEL, Remi, RPMforgeリ…

【Nginx】「[emerg]: could not build the server_names_hash, you should increase server_names_hash_bucket_size: 32」というエラーが出た場合の対処法

Nginxを起動しようとすると以下のエラーが出た。 $ sudo /etc/init.d/nginx start [emerg]: could not build the server_names_hash, you should increase server_names_hash_bucket_size: 32 configuration file /etc/nginx/nginx.conf test failed 長いサ…

www 付きの URL をリダイレクトさせる方法

Apache # /etc/httpd/conf/httpd.conf <VirtualHost *:80> ServerName www.example.com Redirect permanent / http://example.com/ </VirtualHost> <VirtualHost *:80> ServerName example.com </VirtualHost> 恒久的なリダイレクトの場合 permanent を指定すると HTTPステータスコード301 を返してリダイレクトされます。 一…

Nginx で 「413 Request Entity Too Large」 が出る場合

ファイルをアップロードしようとしたら 413 Request Entity Too Large というエラーが発生。 許容範囲外のデータがサーバーに送られた際に出るエラーのようなので client_max_body_size を定義して対応する。 # /etc/nginx/nginx.conf http { .... server { …

【Rails】 RailsでBasic認証を設定する

Rails 側で設定する場合 # app/controllers/application_controller.rb class ApplicationController < ActionController::Base before_action :basic_authentication if Rails.env.production? private def basic_authentication authenticate_or_request_w…

【Rails】本番環境(WebサーバーはNginx)で font-awesome のアイコンが表示されない

Font Awesome を使うとWebページ上に簡単にアイコンを表示させることができる。 # Gemfile gem 'font-awesome-rails' $ bundle install # app/assets/application.css /* *= require font-awesome */ ビューで <h1><i class="icon-camera-retro"></i>&nbsp;Camera</h1> とかやるとアイコンが表示される…