Last active
August 29, 2015 14:05
-
-
Save bugcloud/332ab7dfbb3a774a7f1e to your computer and use it in GitHub Desktop.
Minimun PHP environment on Ubuntu 14.04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name default.dev.xxx; | |
root /home/www/default; | |
index index.html index.php; | |
client_max_body_size 50M; | |
allow all; | |
deny all; | |
access_log /home/www/log/default.access.log; | |
error_log /home/www/log/default.error.log; | |
# http://blog.monoweb.info/article/2012021823.html | |
add_header X-Frame-Options DENY; | |
add_header X-Content-Type-Options nosniff; | |
# gizp settings | |
gzip on; | |
gzip_vary off; | |
gzip_disable "MSIE [1-6]\."; | |
gzip_disable "Mozilla/4"; | |
gzip_types | |
text/plain | |
text/xml | |
text/css | |
text/javascript | |
text/x-component | |
text/x-js | |
text/richtext | |
text/xsd | |
text/xsl | |
image/svg+xml | |
image/x-icon | |
application/xml | |
application/xhtml+xml | |
application/rss+xml | |
application/javascript | |
application/x-javascript | |
; | |
location ~ \.php$ { | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
fastcgi_index index.php; | |
include /etc/nginx/fastcgi_params; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo aptitude install language-pack-ja | |
sudo dpkg-reconfigure locales | |
sudo aptitude update | |
sudo aptitude -y upgrade | |
# install many packages | |
sudo aptitude install -y build-essential sysv-rc-conf git-core zlib1g-dev libreadline6-dev zsh openssl curl wget vim tmux libssl-dev libxml2-dev libxslt1-dev autoconf libgdbm-dev libncurses5-dev automake libtool pkg-config libffi-dev libcurl3 libcurl3-gnutls libcurl4-openssl-dev | |
# install nginx | |
sudo aptitude install -y nginx | |
sudo wget -O /etc/nginx/sites-available/default.conf https://gist.githubusercontent.com/bugcloud/332ab7dfbb3a774a7f1e/raw/c8b10e044a0190b8f243bcecb50f838cb18cd136/default.conf | |
sudo rm -f /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default | |
sudo ln -s /etc/nginx/sites-available/default.conf /etc/nginx/sites-enabled/default.conf | |
# install php | |
sudo aptitude install -y php5 php5-curl php5-fpm | |
sudo sed -i 's/;cgi\.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php5/fpm/php.ini | |
sudo sed -i 's/;date\.timezone =/date.timezone = Asia\/Tokyo/' /etc/php5/fpm/php.ini | |
# set services | |
sudo sysv-rc-conf ssh on | |
sudo sysv-rc-conf nginx on | |
sudo sysv-rc-conf php5-fpm on | |
# create documents | |
sudo mkdir -p /home/www/log | |
sudo mkdir -p /home/www/default | |
sudo sh -c 'echo "<?php phpinfo(); ?>" > /home/www/default/index.php' | |
sudo chown -R www-data:www-data /home/www | |
echo "All done. Do reboot!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment