Skip to content

Instantly share code, notes, and snippets.

@ph4un00b
Created October 6, 2013 21:30
Show Gist options
  • Save ph4un00b/6859342 to your computer and use it in GitHub Desktop.
Save ph4un00b/6859342 to your computer and use it in GitHub Desktop.
web service php/laravel project process
server {
listen 80;
server_name 127.0.0.1;
access_log /vagrant/www/app/storage/logs/access.log;
error_log /vagrant/www/app/storage/logs/error.log;
rewrite_log on;
root /vagrant/www/public/;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
if (!-d $request_filename) {
rewrite ^/(.+)/$ /$1 permanent;
}
location ~* \.php$ {
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param LARAVEL_ENV local;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~ /\.ht {
deny all;
}
location ~* \.(?:ico|css|js|jpe?g|JPG|png|svg|woff)$ {
expires 365d;
}
}

first

  1. ask for name
  • create folder
  1. ask for box name
  • show vagrant boxes link
  • create vagrantfile
  1. set up vm
  • vagrant up

second

  1. update distro
  • sudo apt-get update
  1. get curl
  • sudo apt-get install -y curl
  1. ask for name && email
  2. get git
  • sudo apt-get install -y git-core
  • git config --global color.ui true
  • git config --global user.name "name"
  • git config --global user.email email
  1. get php
  • sudo apt-get install software-properties-common [12.10]
  • sudo apt-get install -y python-software-properties [12.04]
  • sudo add-apt-repository ppa:ondrej/php5
  • sudo apt-get update
  • sudo apt-get install python-software-properties
  • php5-fpm
  • php5-cli
  • php5-mcrypt
  • php5-mysql
  • php5-curl
  1. get composer
  • curl -sS https://getcomposer.org/installer | php
  • sudo mv composer.phar /usr/local/bin/composer
  1. get mysql
  • sudo apt-get install
  • sudo mysql_install_db
  • sudo /usr/bin/mysql_secure_installation
  1. get nginx
  • sudo apt-get install python-software-properties
  • [12.10] sudo apt-get install software-properties-common
  • sudo add-apt-repository ppa:nginx/stable
  • sudo apt-get update
  • sudo apt-get install -y nginx
  1. create server folder
  • mkdir server
  1. create config file
  • touch nginx.conf
  1. remove deafult
  • sudo rm /etc/nginx/sites-available/default
  1. link nginx file
  • sudo ln -s /your-stuff/nginx.conf default
  1. restart nginx server
  • sudo service nginx restart
  1. chgrp -R vagrant /vagrant/www/app/storage/
  2. chmod -R g+w /vagrant/www/app/storage/
#!/usr/bin/env ruby
Vagrant.configure("2") do |config|
config.vm.box_url = "http://files.vagrantup.com/precise32.box"
config.vm.box = "precise32"
config.vm.network :forwarded_port, guest: 80, host: 8888
config.vm.network :private_network, ip: "192.168.33.10"
# config.vm.network :public_network
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment