Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Mac・Windows共通のPHP開発環境

komagata
April 28, 2015

 Mac・Windows共通のPHP開発環境

vagrant + ansibleでPHP開発環境

komagata

April 28, 2015
Tweet

More Decks by komagata

Other Decks in Programming

Transcript

  1. • ϨϯλϧαʔόʔɹˠɹΫϥ΢υ • WindowsɹˠɹMac or Linux • SubversionɹˠɹGithub • ڞ௨։ൃαʔόʔɹˠɹݸਓ։ൃ؀ڥ

    • खಈσϓϩΠɹˠɹܧଓతσϓϩΠ • खಈςετɹˠɹࣗಈςετ ϨΨγʔ1)1։ൃ؀ڥ ͜Μͳײ͡ʹม͍͖͍͑ͯͨΑͶ
  2. WBHSBOU Vagrant.configure(2) do |config| config.vm.box = "chef/centos-6.6" config.vm.network "private_network", ip:

    "192.168.33.10" config.vm.provision "shell", inline: <<-SHELL yum -y install epel-release yum -y install ansible ansible-playbook /vagrant/vagrant.yml --connection=local SHELL end ௚઀ansibleΛ࢖ΘͣɺshellͰansibleΛΠϯετʔϧͯ͠ ࣗ෼ࣗ਎Λprovisionɻ ʢwindows൛ansibleແ͍ͷͰʣ
  3. 7JSUVBM%PDVNFOU3PPU NameVirtualHost *:80 <VirtualHost *:80> VirtualDocumentRoot /srv/%0 </VirtualHost> <directory /srv/*>

    Order allow,deny Allow from all </directory> foo.jpͰΞΫηε͞ΕͨΒ/srv/foo.jpΛDocumentRootͱ͢Δ ศརػೳɻ
 ʢapacheͷ࿩ɻnginxͰ͸΋ͬͱී௨ʹͰ͖Δʣ
  4. EPDSPPUIBDL NameVirtualHost *:80 <VirtualHost *:80> VirtualDocumentRoot /srv/%0 php_admin_value auto_prepend_file /srv/set_docroot_hack.php

    </VirtualHost> VirtualDocumentRoot࢖͏ͱPHPͷDOCUMENT_ROOT͕ ਖ਼͘͠ઃఆ͞Εͳ͍໰୊ͷճආɻ
 ʢnginxͰ͸ུ <?php $_SERVER['DOCUMENT_ROOT'] = str_replace($_SERVER['SCRIPT_NAME'], '', $_SERVER['SCRIPT_FILENAME']);
  5. DIPDPMBUFZ ඞཁͳ෺͕ҰൃͰͦΖ͏ɻΫοιศརʢೋ౓໨ʣ > @powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object

    net.webclient).DownloadString('https://chocolatey.org/ install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin ίϚϯυϓϩϯϓτ͔ΒΠϯετʔϧ > choco install googlechrome firefox curl git virtualbox vagrant -y PowerShellͱ͔NuGetͱ͔windowsͷྲّྀʹैͬͯ ΔͷͰ҆৺ʂ