業界標準のCentOSで皆の大好きなPHPを皆の大好きなnginxで動かす。大前提としてnginxでPHPを動かすならば選択肢はFastCGIということになる。php-fpmというものがあるらしいが、できるだけ標準・準標準のRPMを使うことを考える。まず、CentOSの標準のPHPは--enable-fastcgiつきでコンパイルされているのでFastCGIで動かすにあたって特に問題はない。以下のコマンドで確認できる。 $ php -i | grep fastcgi nginxの設定なので、nginx側で次のような設定を行い、 server { listen 80; server_name goto.php.examle.com; location / { fastcgi_pass 127.0.0.1:8080; fastcgi_index index.php; fastcgi_param
September 20, 2013Setting Up PHP behind Nginx with FastCGI The traditional way of running PHP is with Apache HTTP Server using mod_php. In fact, mod_php was the most popular Apache module up until 2009 when that claim went to mod_ssl. But as the Internet grew and the technologies that power it evolved, other ways of serving PHP sites and applications became available. nginx, a server written to so
こんにちは、井川です。連日、猛暑続きですね。熱中症には気を付けて、がんばりましょう。 今回は、軽量なWebサーバであるnginxとPHPを組み合わせて使う方法を紹介します。 Webサイトにとって、軽さはとても重要なポイントです。PHPはライトウェイトな言語でありながらも、symfonyなど最近のフレームワーク次第ではWebサイトが重くなってしまいます。特に、Apacheで多くのリクエストを同時に受け付けると、レスポンスを返さなくなることがあります。こうした場合、キャッシュを使ったり、Key/ValueストアやMongoDBなどNoSQLにしたり、スケールアウトしたりと、様々な対応が考えられます。 しかし、もっと根本的な解決方法はないでしょうか? WebサーバとしてApacheではなく、nginxとFastcgi-PHPを使ってみましょう(lighttpdなどもありますが…)。ベンチマークで
Nginx joins the big leagues in Ubuntu Server Ubuntu Server 14.04 is set to include Nginx Web server as standard, along with the old favorite Apache We hardly need more proof that the Nginx Web server has become a major-league player. According to Netcraft, it's currently the No. 3 Web server (14 percent of all sites), behind only Microsoft IIS (24 percent) and Apache (44 percent). Netflix, Hulu, P
Maxim Dounin mdounin at mdounin.ru Tue Nov 19 15:02:26 UTC 2013 Previous message: [nginx-announce] nginx-1.4.4 Next message: [nginx-announce] nginx-1.5.8 Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] Hello! Ivan Fratric of the Google Security Team discovered a bug in nginx, which might allow an attacker to bypass security restrictions in certain configurations by using a specially
http://wiki.nginx.org/NginxHttpCoreModule#location 少しはまった。正規表現の設定のほうが後で評価されて、設定が上書きされるのか。そういえば、apacheもそうだったかな? 例 URL: /fooにaliasを設定しているとする。で、/foo以外の画像(正規表現で指定)へのリクエストはreverse proxyしたいとする(/foo/bar.jpgはreverse proxyさせずにaliasで設定しているdirectoryから配信したい)。 この場合、/fooの設定は"location /foo"ではなくて、"location ^~ /foo"じゃないとダメ。 ###### 設定A # location /foo { # 間違い location ^~ /foo { alias /path/to/foo; index index.html
// Tutorial //How To Configure Logging and Log Rotation in Nginx on an Ubuntu VPS Introduction To save yourself some trouble with your web server, you can configure logging. Logging information on your server gives you access to the data that will help you troubleshoot and assess situations as they arise. In this tutorial, you will examine Nginx’s logging capabilities and discover how to configure
社内向けのアプリを動かしているNginxのログフォーマットをLTSVに変更したのでメモ。 ログフォーマット追加 vi /usr/local/nginx/conf/nginx.conf user nginx nginx; worker_processes 2; worker_priority 0; worker_rlimit_nofile 8192; error_log logs/error.log notice; pid logs/nginx.pid; events { multi_accept off; worker_connections 1024; use epoll; } http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_
The ngx_http_log_module module writes request logs in the specified format. Requests are logged in the context of a location where processing ends. It may be different from the original location, if an internal redirect happens during request processing. log_format compression '$remote_addr - $remote_user [$time_local] ' '"$request" $status $bytes_sent ' '"$http_referer" "$http_user_agent" "$gzip_
Apache Proxy Balancer をロードバランサー(LB)として使っていて、 困ったことは、Web/AP サーバが LB を経由してアクセスしてきたクライアントの IP を知る方法がわからなかったことです。 Web/AP サーバ上でも Apache が動いていますが、その access_log を見ても、下記のように、LB 側の IP が表示されてしまいます。 [sourcecode language="plain"] 10.xx.xx.xx – - [18/Nov/2010:03:03:48 -0500] "GET / HTTP/1.1" 200 44 [/sourcecode] その方法を見つけて試しましたので、ブログに載せます。 http://httpd.apache.org/docs/current/mod/mod_proxy.html Apache のサイトによると、
ロードバランスというかupstreamの設定に関するメモ。 参考 http://nginx.org/en/docs/http/ngx_http_upstream_module.html 振り分けの重みづけしたい weightで調整 upstream backend { server example-1:8080 weight=4; server example-2:8080; }上記設定では、例えば5回のアクセスがあったら以下の配分となる example-1 5回中4回のアクセス example-2 5回中1回のアクセス バックエンドのアクセスが失敗した時の挙動を調整したい max_failsとfail_timeoutで調整 upstream backend { ip_hash; server example-1:8080 max_fails=3 fal_timeout=10s; serv
はじめに nginxは頻繁に保守されていてどんどんバージョンが上がっていく一方で、UbuntuやWindows以外ではソースコードからビルドする方法が一般的だと思います。 nginxのバージョンアップ頻度 2011/05/10 1.0.2 2011/05/03 1.0.1 2011/04/12 1.0.0 2011/04/04 0.9.7 2011/03/21 0.9.6 nginx CHANGESより LinuxやBSDの多くのディストリビューションではNginxがパッケージリポジトリに含まれており、通常のソフトウェアインストール手法でインストールする事ができます。(Debianにおけるapt-getや、Gentooにおけるemerge、FreeBSDにおけるports、Fedora の yum、Vine Linux の apt-get など) たまにこれらのパッケージは古いものであった
Sets the shared memory zone and the maximum burst size of requests. If the requests rate exceeds the rate configured for a zone, their processing is delayed such that requests are processed at a defined rate. Excessive requests are delayed until their number exceeds the maximum burst size in which case the request is terminated with an error. By default, the maximum burst size is equal to zero. Fo
http://example.com や http://example.com/ にアクセスした時はランディングページに飛ばして、それ以外はアプリケーションで動かすためのnginxの設定です。 「location = /」という記述で、上記の二つを認識できます。 server{ listen 80; server_name example.com; root /var/www/app/test; location / { proxy_pass http://sinatra; } location = / { root /var/www/test/public; index index.htm; } }
どうも、タローポチです 自分、ウェブプログラマーしているんですが、今度、サイトをメンテナンスするためサーバーを止めないといけないのですが、そのためのメンテナンス画面に切り替えるメモを書きます 使用しているウェブサーバーはnginxです 仕様は静的html(メンテナンス画面)maintenance.htmlをnow_maintenance.htmlにコピーすると画面がメンテナンスに自動的に切り替わる 特定のIPアドレスからは通常のサービス画面が表示される now_maintenance.htmlを削除すると通常のサービス画面が表示される 上記が仕様です メインのnginx.confファイルは書き換えない nginx.conf内にインクルードされているファイルを書き換える /etc/nginx/conf.d/app.inc nginx.confにインクルードされているアプリコンフ /etc/n
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く