nginx+Php5環境の試作

PHP and nginx on Ubuntu: the easy way
ここを参考に
php-fastcgiとして作る。
サーバへの記載とだけありわからないので、
Installing Nginx With PHP5 (And PHP-FPM) And MySQL Support (LEMP) On Ubuntu 13.04から
apt-get install php5-fpm
ということでどうやら、fpmから起動する様になると思うので、
PHP and nginx on Ubuntu: the easy wayの方のphp-fastcgiは消します。
# update-rc.d -f php-fastcgi remove
/etc/nginx/nginx.conf 設定。
/etc/nginx/sites-available/default 設定。
ここで、サーバのルートを入れておく。
server {
listen 80;
root /ほげほげ/Public/pukiwiki_adv-2.0.0/webroot;
index index.php;
# Make site accessible from http://localhost/
# server_name localhost;
location / {
root /ほげほげ/Public/pukiwiki_adv-2.0.0/webroot;
index index.php;
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
# try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
ここ以降に、php関係の設定が入る。
/etc/php5/fpm/php.ini 設定。
写真のページのアップロードのために、
memory_limit = 256M
upload_max_filesize = 20M
post_max_size = 10M
と入れておきます。
 これだけでは、アップロード時に、エラーが出るので、以下で対処して置きます。
nginx server error: 413 Request Entity Too Large
http {
client_max_body_size 10M;
MBでなくMなので注意。
メモまで。

PC

Posted by masterkudo