安装配置:
mysql: http://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/ yum repolist enabled | grep mysql rm -rf /etc/yum.repos.d/mysql*.config-file-path vim /etc/yum.repos.d/mysql-community.repo #note the baseurl, centos6 --> el6, view the system version: uname -r # Enable to use MySQL 5.6 [mysql56-community] name=MySQL 5.6 Community Server baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/6/$basearch/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql yum install mysql-community-server service mysqld start mysql -uroot -p create user 'vagrant'@'%' identified by 'vagrant'; grant all privileges on *.* to vagrant@'%'identified by 'password'; PHP: 1.检查当前安装的PHP包 yum list installed | grep php 如果有安装的PHP包,先删除他们 yum remove php.x86_64 php-cli.x86_64 php-common.x86_64 php-gd.x86_64 php-ldap.x86_64 php-mbstring.x86_64 php-mcrypt.x86_64 php-mysql.x86_64 php-pdo.x86_64 2.CentOs 6.x rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm CentOs 7.X rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm 3.运行yum install yum install php56w.x86_64 php56w-cli.x86_64 php56w-common.x86_64 php56w-gd.x86_64 php56w-ldap.x86_64 php56w-mbstring.x86_64 php56w-mcrypt.x86_64 php56w-mysql.x86_64 php56w-pdo.x86_64 php56w-bcmath.x86_64 php56w-devel.x86_64 yum install php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-mysql.x86_64 php70w-pdo.x86_64 php70w-bcmath.x86_64 php70w-devel.x86_64
4.安装PHP FPM yum install php56w-fpm yum install php70w-fpm
5.service php-fpm start nginx: rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm yum install nginx service nginx start vim /etc/nginx/nginx.conf #include /etc/nginx/conf.d/*.conf; #去掉行首的#, vim /etc/nginx/conf.d/php-dev.conf server { listen 80; server_name php-dev.jobstreet.com; index index.html index.htm index.php; root /var/www/html; location ~ \.php$ { include fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } } PHP Demo: 注意开启 service php-fpm start
php -r "readfile('https://getcomposer.org/installer');" > composer-setup.php
php composer-setup.php
php -r "unlink('composer-setup.php');"
mv composer.phar /usr/local/bin/composer
composer dump-autoload
php artisan make:auth
php artisan migrate
php artisan make:model Article
php artisan make:migration create_article_table
php artisan make:seeder ArticleSeeder
php artisan db:seed
附nginx配置laravel:
server { listen 80; server_name php-dev.jobstreet.com; set $root_path '/workspaces/hello-php/laravel/public'; root $root_path; index index.php index.html index.htm; try_files $uri $uri/ @rewrite; location @rewrite { rewrite ^/(.*)$ /index.php?_url=/$1; } location ~ \.php { fastcgi_pass 127.0.0.1:9000; fastcgi_index /index.php; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~* ^/(css|img|js|flv|swf|download)/(.+)$ { root $root_path; } location ~ /\.ht { deny all; } }