├── .gitignore ├── README.md ├── Vagrantfile ├── centos-mysql-phpmyadmin ├── Dockerfile ├── config.inc.php ├── scripts │ ├── config.sh │ └── run.sh └── supervisord.conf ├── centos-nginx-php-hhvm ├── Dockerfile ├── README.md ├── config.hdf ├── nginx.conf ├── scripts │ └── run.sh └── supervisord.conf └── scripts ├── centos64 └── setup_nginx_hhvm.sh └── install_fastcgi.sh /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | #ignore vagrant files 3 | .vagrant/ 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | dockerfiles 2 | =========== 3 | 4 | My docker repository files 5 | 6 | This repo contains Dockerfiles, all config files and scripts for my [public Docker hub repositories](https://registry.hub.docker.com/u/mebinum/). 7 | 8 | ## Images 9 | 10 | - [Cent OS image configured with Nginx, PHP5 and Hip Hop VM - `HHVM` -] (https://registry.hub.docker.com/u/mebinum/centos-nginx-php5-hhvm/) 11 | - [Cent OS image configured with my sql database and phpmyadmin] (https://registry.hub.docker.com/u/mebinum/centos-mysql-phpmyadmin/) 12 | 13 | Fork away. 14 | 15 | Got a question? Hit me up on twitter [@mikeebinum](https://twitter.com/mikeebinum) 16 | 17 | 18 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! 5 | VAGRANTFILE_API_VERSION = "2" 6 | 7 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 8 | # All Vagrant configuration is done here. The most common configuration 9 | # options are documented and commented below. For a complete reference, 10 | # please see the online documentation at vagrantup.com. 11 | 12 | # Every Vagrant virtual environment requires a box to build off of. 13 | config.vm.box = "centos64-x86_64-20140116" 14 | #config.vm.box = "mitchellh/boot2docker" 15 | 16 | # The url from where the 'config.vm.box' box will be fetched if it 17 | # doesn't already exist on the user's system. 18 | config.vm.box_url = "https://github.com/2creatives/vagrant-centos/releases/download/v6.4.2/centos64-x86_64-20140116.box" 19 | #config.vm.box_url = "https://vagrantcloud.com/mitchellh/boot2docker" 20 | # Create a forwarded port mapping which allows access to a specific port 21 | # within the machine from a port on the host machine. In the example below, 22 | # accessing "localhost:8080" will access port 80 on the guest machine. 23 | #config.vm.network "forwarded_port", guest: 80, host: 9090 , auto_correct: true 24 | 25 | # Create a private network, which allows host-only access to the machine 26 | # using a specific IP. 27 | # config.vm.network "private_network", ip: "192.168.33.10" 28 | 29 | # Create a public network, which generally matched to bridged network. 30 | # Bridged networks make the machine appear as another physical device on 31 | # your network. 32 | # config.vm.network "public_network" 33 | 34 | # If true, then any SSH connections made will enable agent forwarding. 35 | # Default value: false 36 | # config.ssh.forward_agent = true 37 | 38 | # Share an additional folder to the guest VM. The first argument is 39 | # the path on the host to the actual folder. The second argument is 40 | # the path on the guest to mount the folder. And the optional third 41 | # argument is a set of non-required options. 42 | # config.vm.synced_folder "../data", "/vagrant_data" 43 | 44 | # Provider-specific configuration so you can fine-tune various 45 | # backing providers for Vagrant. These expose provider-specific options. 46 | # Example for VirtualBox: 47 | # 48 | config.vm.provider "virtualbox" do |vb| 49 | # # Don't boot with headless mode 50 | # vb.gui = true 51 | # 52 | # # Use VBoxManage to customize the VM. For example to change memory: 53 | vb.customize ["modifyvm", :id, "--memory", "1536"] 54 | end 55 | # # 56 | # View the documentation for the provider you're using for more 57 | # information on available options. 58 | 59 | # Enable provisioning with CFEngine. CFEngine Community packages are 60 | # automatically installed. For example, configure the host as a 61 | # policy server and optionally a policy file to run: 62 | # 63 | # config.vm.provision "cfengine" do |cf| 64 | # cf.am_policy_hub = true 65 | # # cf.run_file = "motd.cf" 66 | # end 67 | # 68 | # You can also configure and bootstrap a client to an existing 69 | # policy server: 70 | # 71 | # config.vm.provision "cfengine" do |cf| 72 | # cf.policy_server_address = "10.0.2.15" 73 | # end 74 | 75 | # Enable provisioning with Puppet stand alone. Puppet manifests 76 | # are contained in a directory path relative to this Vagrantfile. 77 | # You will need to create the manifests directory and a manifest in 78 | # the file default.pp in the manifests_path directory. 79 | # 80 | # config.vm.provision "puppet" do |puppet| 81 | # puppet.manifests_path = "manifests" 82 | # puppet.manifest_file = "site.pp" 83 | # end 84 | 85 | # Enable provisioning with chef solo, specifying a cookbooks path, roles 86 | # path, and data_bags path (all relative to this Vagrantfile), and adding 87 | # some recipes and/or roles. 88 | # 89 | # config.vm.provision "chef_solo" do |chef| 90 | # chef.cookbooks_path = "../my-recipes/cookbooks" 91 | # chef.roles_path = "../my-recipes/roles" 92 | # chef.data_bags_path = "../my-recipes/data_bags" 93 | # chef.add_recipe "mysql" 94 | # chef.add_role "web" 95 | # 96 | # # You may also specify custom JSON attributes: 97 | # chef.json = { :mysql_password => "foo" } 98 | # end 99 | 100 | # Enable provisioning with chef server, specifying the chef server URL, 101 | # and the path to the validation key (relative to this Vagrantfile). 102 | # 103 | # The Opscode Platform uses HTTPS. Substitute your organization for 104 | # ORGNAME in the URL and validation key. 105 | # 106 | # If you have your own Chef Server, use the appropriate URL, which may be 107 | # HTTP instead of HTTPS depending on your configuration. Also change the 108 | # validation key to validation.pem. 109 | # 110 | # config.vm.provision "chef_client" do |chef| 111 | # chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME" 112 | # chef.validation_key_path = "ORGNAME-validator.pem" 113 | # end 114 | # 115 | #config.vm.provision :shell, inline: "sudo yum install -y docker-io" 116 | 117 | config.vm.define "default", primary: true do |default| 118 | default.vm.network "forwarded_port", guest: 80, host: 8081, autocorrect: true 119 | end 120 | 121 | config.vm.define "phpNginx" do |phpNginx| 122 | phpNginx.vm.box = "hashicorp/precise64" 123 | 124 | phpNginx.vm.network "forwarded_port", guest: 80, host: 8082, autocorrect: true 125 | 126 | folder = "./centos-nginx-php-hhvm/" 127 | 128 | phpNginx.vm.provision :docker do |d| 129 | d.build_image "/vagrant", args: "-t centos-nginx-php5-hhvm --no-cache=false" 130 | d.run "centos-nginx-php5-hhvm", args: "-d -p 80:80 -m 512m", cmd: "/run.sh", image: "centos-nginx-php5-hhvm:latest" ,daemonize: true 131 | end 132 | 133 | phpNginx.vm.synced_folder folder, "/vagrant" 134 | end 135 | 136 | config.vm.define :phpMyAdmin do |phpMyAdmin| 137 | phpMyAdmin.vm.box = "hashicorp/precise64" 138 | 139 | phpMyAdmin.vm.network "forwarded_port", guest: 80, host: 8083, autocorrect: true 140 | 141 | folder = "./centos-mysql-phpmyadmin/" 142 | 143 | phpMyAdmin.vm.provision :docker do |d| 144 | d.build_image "/vagrant", args: "-t centos-mysql-phpmyadmin --no-cache=false" 145 | d.run "centos-mysql-phpmyadmin", args: "-d -p 80:80", cmd: "/run.sh", image: "centos-mysql-phpmyadmin:latest" ,daemonize: true 146 | end 147 | 148 | phpMyAdmin.vm.synced_folder folder, "/vagrant" 149 | end 150 | 151 | # If you're using the Opscode platform, your validator client is 152 | # ORGNAME-validator, replacing ORGNAME with your organization name. 153 | # 154 | # If you have your own Chef Server, the default validation client name is 155 | # chef-validator, unless you changed the configuration. 156 | # 157 | # chef.validation_client_name = "ORGNAME-validator" 158 | end 159 | -------------------------------------------------------------------------------- /centos-mysql-phpmyadmin/Dockerfile: -------------------------------------------------------------------------------- 1 | # DOCKER-VERSION 1.0.0 2 | 3 | FROM centos:6.4 4 | 5 | MAINTAINER Mike Ebinum, mike@seedtech.io 6 | 7 | # Add the EPEL repo to the machine 8 | # yum update -y >/dev/null && 9 | RUN yum install -y http://ftp.riken.jp/Linux/fedora/epel/6/i386/epel-release-6-8.noarch.rpm && curl -L -o /etc/yum.repos.d/hop5.repo "http://www.hop5.in/yum/el6/hop5.repo" 10 | 11 | # Install supervisor 12 | RUN yum install -y python-meld3 http://dl.fedoraproject.org/pub/epel/6/i386/supervisor-2.1-8.el6.noarch.rpm 13 | 14 | #install phpmyadmin and mysql-servers 15 | RUN ["yum", "-y", "install", "phpmyadmin","mysql-server","mysql","pwgen"] 16 | 17 | # ADD supervisord config 18 | ADD supervisord.conf /etc/supervisord.conf 19 | 20 | #add Phpmyadmin configuration 21 | ADD config.inc.php /etc/phpMyAdmin/config.inc.php 22 | 23 | #set mysql to connect to all addresses 24 | #RUN sed -i -e"s/^bind-address\s*=\s*127.0.0.1/bind-address = 0.0.0.0/" /etc/mysql/my.cnf 25 | 26 | #set phpmyadmin to allow requests from local ips only 27 | RUN sed -i -e"s/Require ip 127.0.0.1/Require ip 10 192.168/" -e"s/Allow from 127.0.0.1/Allow from 10 192.168/" /etc/httpd/conf.d/phpMyAdmin.conf 28 | 29 | #setup mysql 30 | ADD scripts/config.sh /config.sh 31 | 32 | RUN chmod a+x /config.sh && /config.sh 33 | 34 | ADD scripts/run.sh /run.sh 35 | 36 | RUN chmod a+x /run.sh 37 | 38 | EXPOSE 80 39 | #Start supervisord (which will start hhvm), nginx, mysql 40 | #ENTRYPOINT ["/run.sh"] 41 | 42 | -------------------------------------------------------------------------------- /centos-mysql-phpmyadmin/config.inc.php: -------------------------------------------------------------------------------- 1 | . 8 | */ 9 | 10 | /* 11 | * This is needed for cookie based authentication to encrypt password in 12 | * cookie 13 | */ 14 | $cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */ 15 | 16 | /** 17 | * Server(s) configuration 18 | */ 19 | $i = 0; 20 | 21 | // The $cfg['Servers'] array starts with $cfg['Servers'][1]. Do not use 22 | // $cfg['Servers'][0]. You can disable a server config entry by setting host 23 | // to ''. If you want more than one server, just copy following section 24 | // (including $i incrementation) serveral times. There is no need to define 25 | // full server array, just define values you need to change. 26 | $i++; 27 | $cfg['Servers'][$i]['host'] = 'localhost'; // MySQL hostname or IP address 28 | $cfg['Servers'][$i]['port'] = ''; // MySQL port - leave blank for default port 29 | $cfg['Servers'][$i]['socket'] = ''; // Path to the socket - leave blank for default socket 30 | $cfg['Servers'][$i]['connect_type'] = 'tcp'; // How to connect to MySQL server ('tcp' or 'socket') 31 | $cfg['Servers'][$i]['extension'] = 'mysqli'; // The php MySQL extension to use ('mysql' or 'mysqli') 32 | $cfg['Servers'][$i]['compress'] = FALSE; // Use compressed protocol for the MySQL connection 33 | // (requires PHP >= 4.3.0) 34 | $cfg['Servers'][$i]['controluser'] = ''; // MySQL control user settings 35 | // (this user must have read-only 36 | $cfg['Servers'][$i]['controlpass'] = ''; // access to the "mysql/user" 37 | // and "mysql/db" tables). 38 | // The controluser is also 39 | // used for all relational 40 | // features (pmadb) 41 | $cfg['Servers'][$i]['auth_type'] = 'http'; // Authentication method (config, http or cookie based)? 42 | $cfg['Servers'][$i]['user'] = ''; // MySQL user 43 | $cfg['Servers'][$i]['password'] = ''; // MySQL password (only needed 44 | // with 'config' auth_type) 45 | $cfg['Servers'][$i]['only_db'] = ''; // If set to a db-name, only 46 | // this db is displayed in left frame 47 | // It may also be an array of db-names, where sorting order is relevant. 48 | $cfg['Servers'][$i]['hide_db'] = ''; // Database name to be hidden from listings 49 | $cfg['Servers'][$i]['verbose'] = ''; // Verbose name for this host - leave blank to show the hostname 50 | 51 | $cfg['Servers'][$i]['pmadb'] = ''; // Database used for Relation, Bookmark and PDF Features 52 | // (see scripts/create_tables.sql) 53 | // - leave blank for no support 54 | // DEFAULT: 'phpmyadmin' 55 | $cfg['Servers'][$i]['bookmarktable'] = ''; // Bookmark table 56 | // - leave blank for no bookmark support 57 | // DEFAULT: 'pma_bookmark' 58 | $cfg['Servers'][$i]['relation'] = ''; // table to describe the relation between links (see doc) 59 | // - leave blank for no relation-links support 60 | // DEFAULT: 'pma_relation' 61 | $cfg['Servers'][$i]['table_info'] = ''; // table to describe the display fields 62 | // - leave blank for no display fields support 63 | // DEFAULT: 'pma_table_info' 64 | $cfg['Servers'][$i]['table_coords'] = ''; // table to describe the tables position for the PDF schema 65 | // - leave blank for no PDF schema support 66 | // DEFAULT: 'pma_table_coords' 67 | $cfg['Servers'][$i]['pdf_pages'] = ''; // table to describe pages of relationpdf 68 | // - leave blank if you don't want to use this 69 | // DEFAULT: 'pma_pdf_pages' 70 | $cfg['Servers'][$i]['column_info'] = ''; // table to store column information 71 | // - leave blank for no column comments/mime types 72 | // DEFAULT: 'pma_column_info' 73 | $cfg['Servers'][$i]['history'] = ''; // table to store SQL history 74 | // - leave blank for no SQL query history 75 | // DEFAULT: 'pma_history' 76 | $cfg['Servers'][$i]['verbose_check'] = TRUE; // set to FALSE if you know that your pma_* tables 77 | // are up to date. This prevents compatibility 78 | // checks and thereby increases performance. 79 | $cfg['Servers'][$i]['AllowRoot'] = TRUE; // whether to allow root login 80 | $cfg['Servers'][$i]['AllowDeny']['order'] // Host authentication order, leave blank to not use 81 | = ''; 82 | $cfg['Servers'][$i]['AllowDeny']['rules'] // Host authentication rules, leave blank for defaults 83 | = array(); 84 | $cfg['Servers'][$i]['AllowNoPassword'] // Allow logins without a password. Do not change the FALSE 85 | = FALSE; // default unless you're running a passwordless MySQL server 86 | $cfg['Servers'][$i]['designer_coords'] // Leave blank (default) for no Designer support, otherwise 87 | = ''; // set to suggested 'pma_designer_coords' if really needed 88 | $cfg['Servers'][$i]['bs_garbage_threshold'] // Blobstreaming: Recommented default value from upstream 89 | = 50; // DEFAULT: '50' 90 | $cfg['Servers'][$i]['bs_repository_threshold'] // Blobstreaming: Recommented default value from upstream 91 | = '32M'; // DEFAULT: '32M' 92 | $cfg['Servers'][$i]['bs_temp_blob_timeout'] // Blobstreaming: Recommented default value from upstream 93 | = 600; // DEFAULT: '600' 94 | $cfg['Servers'][$i]['bs_temp_log_threshold'] // Blobstreaming: Recommented default value from upstream 95 | = '32M'; // DEFAULT: '32M' 96 | /* 97 | * End of servers configuration 98 | */ 99 | 100 | /* 101 | * Directories for saving/loading files from server 102 | */ 103 | $cfg['UploadDir'] = '/var/lib/phpMyAdmin/upload'; 104 | $cfg['SaveDir'] = '/var/lib/phpMyAdmin/save'; 105 | 106 | /* 107 | * Disable the default warning that is displayed on the DB Details Structure 108 | * page if any of the required Tables for the relation features is not found 109 | */ 110 | $cfg['PmaNoRelation_DisableWarning'] = TRUE; 111 | ?> 112 | -------------------------------------------------------------------------------- /centos-mysql-phpmyadmin/scripts/config.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e -x 3 | #Modified from https://github.com/ricardoamaro/docker-drupal/blob/master/start.sh 4 | #and https://gist.github.com/benschw/7391723 5 | 6 | if [ ! -f /var/lib/mysql/ibdata1 ]; then 7 | # Start mysql 8 | mysql_install_db 9 | 10 | /usr/bin/mysqld_safe & 11 | sleep 10s 12 | 13 | # Generate random passwords 14 | MYADMIN_DB="phpmyadmin" 15 | MYSQL_PASSWORD=`pwgen -c -n -1 12` 16 | MYADMIN_PASSWORD=`pwgen -c -n -1 12` 17 | 18 | # This is so the passwords show up in logs. 19 | echo mysql root password: $MYSQL_PASSWORD 20 | echo phpmyadmin password: $MYADMIN_PASSWORD 21 | echo $MYSQL_PASSWORD > /mysql-root-pw.txt 22 | echo $MYADMIN_PASSWORD > /myadmin-db-pw.txt 23 | mysqladmin -u root password $MYSQL_PASSWORD 24 | mysql -uroot -p$MYSQL_PASSWORD -e "CREATE DATABASE phpmyadmin; GRANT ALL PRIVILEGES ON phpmyadmin.* TO 'phpmyadmin'@'localhost' IDENTIFIED BY '$MYADMIN_PASSWORD'; FLUSH PRIVILEGES;" 25 | 26 | killall mysqld 27 | sleep 10s 28 | fi -------------------------------------------------------------------------------- /centos-mysql-phpmyadmin/scripts/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e -x 3 | echo "mysql root pwd" 4 | cat /mysql-root-pw.txt 5 | echo "phpmyadmin pwd" 6 | cat /myadmin-db-pw.txt 7 | echo "starting supervisor in foreground" 8 | supervisord -n -------------------------------------------------------------------------------- /centos-mysql-phpmyadmin/supervisord.conf: -------------------------------------------------------------------------------- 1 | [supervisord] 2 | http_port=/var/tmp/supervisor.sock ; (default is to run a UNIX domain socket server) 3 | 4 | logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log) 5 | logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB) 6 | logfile_backups=10 ; (num of main logfile rotation backups;default 10) 7 | loglevel=info ; (logging level;default info; others: debug,warn) 8 | pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid) 9 | nodaemon=false ; (start in foreground if true;default false) 10 | minfds=1024 ; (min. avail startup file descriptors;default 1024) 11 | minprocs=200 ; (min. avail process descriptors;default 200) 12 | 13 | [supervisorctl] 14 | serverurl=unix:///var/tmp/supervisor.sock ; use a unix:// URL for a unix socket 15 | 16 | [program:mysql] 17 | command=mysqld_safe 18 | autostart=true 19 | autorestart=true 20 | redirect_stderr=true 21 | 22 | [program:apache2] 23 | command=httpd -c "ErrorLog /dev/stdout" -DFOREGROUND 24 | #user = root 25 | autostart=true 26 | autorestart=true 27 | redirect_stderr=true -------------------------------------------------------------------------------- /centos-nginx-php-hhvm/Dockerfile: -------------------------------------------------------------------------------- 1 | # DOCKER-VERSION 1.0.0 2 | 3 | FROM centos:centos6 4 | 5 | MAINTAINER Mike Ebinum, mike@seedtech.io 6 | 7 | # Install dependencies for HHVM 8 | # yum update -y >/dev/null && 9 | RUN yum install -y http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm && curl -L -o /etc/yum.repos.d/hop5.repo "http://www.hop5.in/yum/el6/hop5.repo" 10 | 11 | # Install supervisor 12 | RUN yum install -y python-meld3 http://dl.fedoraproject.org/pub/epel/6/i386/supervisor-2.1-8.el6.noarch.rpm 13 | 14 | #install nginx, php, mysql, hhvm 15 | RUN ["yum", "-y", "install", "nginx", "php", "php-mysql", "php-devel", "php-gd", "php-pecl-memcache", "php-pspell", "php-snmp", "php-xmlrpc", "php-xml","hhvm"] 16 | 17 | # Create folder for server and add index.php file to for nginx 18 | RUN mkdir -p /var/www/html && chmod a+r /var/www/html && echo "" > /var/www/html/index.php 19 | 20 | #Setup hhvm - add config for hhvm 21 | ADD config.hdf /etc/hhvm/config.hdf 22 | 23 | RUN service hhvm restart 24 | 25 | # ADD Nginx config 26 | ADD nginx.conf /etc/nginx/conf.d/default.conf 27 | 28 | # ADD supervisord config with hhvm setup 29 | ADD supervisord.conf /etc/supervisord.conf 30 | 31 | #set to start automatically - supervisord, nginx and mysql 32 | RUN chkconfig supervisord on && chkconfig nginx on 33 | 34 | ADD scripts/run.sh /run.sh 35 | 36 | RUN chmod a+x /run.sh 37 | 38 | 39 | EXPOSE 22 80 40 | #Start supervisord (which will start hhvm), nginx, mysql 41 | ENTRYPOINT ["/run.sh"] 42 | 43 | -------------------------------------------------------------------------------- /centos-nginx-php-hhvm/README.md: -------------------------------------------------------------------------------- 1 | #README -------------------------------------------------------------------------------- /centos-nginx-php-hhvm/config.hdf: -------------------------------------------------------------------------------- 1 | PidFile = /var/run/hhvm/pid 2 | 3 | Eval { 4 | JitASize = 536870912 #512MB 5 | JitAStubsSize = 536870912 #512MB 6 | JitGlobalDataSize = 134217728 #128MB 7 | } 8 | 9 | 10 | Server { 11 | Port = 8000 12 | SourceRoot = /var/www/html/ 13 | Type = fastcgi 14 | DefaultDocument = index.php 15 | } 16 | 17 | Log { 18 | Level = Warning 19 | AlwaysLogUnhandledExceptions = true 20 | RuntimeErrorReportingLevel = 8191 21 | UseLogFile = true 22 | UseSyslog = false 23 | File = /var/log/hhvm/error.log 24 | Access { 25 | * { 26 | File = /var/log/hhvm/access.log 27 | Format = %h %l %u % t \"%r\" %>s %b 28 | } 29 | } 30 | } 31 | 32 | Repo { 33 | Central { 34 | Path = /var/log/hhvm/.hhvm.hhbc 35 | } 36 | } 37 | 38 | #include "/usr/share/hhvm/hdf/static.mime-types.hdf" 39 | StaticFile { 40 | FilesMatch { 41 | * { 42 | pattern = .*\.(dll|exe) 43 | headers { 44 | * = Content-Disposition: attachment 45 | } 46 | } 47 | } 48 | Extensions : StaticMimeTypes 49 | } 50 | 51 | MySQL { 52 | TypedResults = false 53 | } 54 | -------------------------------------------------------------------------------- /centos-nginx-php-hhvm/nginx.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | server_name localhost; 4 | 5 | root /var/www/html; 6 | index index.php index.html index.htm; 7 | 8 | #forward hack and php request to hhvm 9 | location ~ \.(hh|php)$ { 10 | fastcgi_pass 127.0.0.1:8000; 11 | fastcgi_index index.php; 12 | fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name; 13 | include fastcgi_params; 14 | } 15 | 16 | #deny access to .ht access files 17 | location ~ /\.ht { 18 | deny all; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /centos-nginx-php-hhvm/scripts/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e -x 3 | echo "starting supervisor in foreground" 4 | supervisord -n 5 | -------------------------------------------------------------------------------- /centos-nginx-php-hhvm/supervisord.conf: -------------------------------------------------------------------------------- 1 | [supervisord] 2 | http_port=/var/tmp/supervisor.sock ; (default is to run a UNIX domain socket server) 3 | 4 | logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log) 5 | logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB) 6 | logfile_backups=10 ; (num of main logfile rotation backups;default 10) 7 | loglevel=info ; (logging level;default info; others: debug,warn) 8 | pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid) 9 | nodaemon=false ; (start in foreground if true;default false) 10 | minfds=1024 ; (min. avail startup file descriptors;default 1024) 11 | minprocs=200 ; (min. avail process descriptors;default 200) 12 | 13 | [supervisorctl] 14 | serverurl=unix:///var/tmp/supervisor.sock ; use a unix:// URL for a unix socket 15 | 16 | [program:hhvm] 17 | directory=/var/www/html 18 | command=hhvm -m server -p 8000 19 | autostart=true 20 | autorestart=true 21 | redirect_stderr=true 22 | 23 | [program:nginx] 24 | command=nginx 25 | #user = root 26 | autostart=true 27 | autorestart=true -------------------------------------------------------------------------------- /scripts/centos64/setup_nginx_hhvm.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e -x 3 | 4 | echo "Creating HHVM config for nginx" 5 | 6 | echo "Backup nginx default configs" 7 | if [-a '/etc/nginx/sites-enabled/default'] ; then 8 | mv /etc/nginx/sites-enabled/default /etc/nginx/sites-enabled/default.bak 9 | fi 10 | 11 | if [-a '/etc/nginx/conf.d/default.conf'] ; then 12 | mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf 13 | fi 14 | 15 | cat > /etc/nginx/conf.d/default <\nDirectoryIndex index.html index.shtml index.cgi index.php\nAddHandler php5-fcgi .php\nAction php5-fcgi /php5-fcgi\nAlias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi\nFastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -pass-header Authorization\n" >> /etc/httpd/conf.d/fastcgi.conf 9 | 10 | mkdir /usr/lib/cgi-bin/ 11 | 12 | chown -R apache:apache /var/run/mod_fastcgi 13 | 14 | sed -i 's/LoadModule php5_module/\#LoadModule php5_module/g;s/AddHandler/\#AddHandler/g;s/AddType/\#AddType/g;' /etc/httpd/conf.d/php.conf 15 | 16 | httpd restart --------------------------------------------------------------------------------