• centos6: mysql+nginx+php


    安装配置:

    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;    
        }    
    }  
  • 相关阅读:
    从零开始在虚拟机中搭建一个4个节点的CentOS集群(三)-----将一台虚拟机复制成4台虚拟机
    从零开始在虚拟机中搭建一个4个节点的CentOS集群(二)-----在虚拟机中安装Java和Perl
    java后台访问接口
    java文件名更改一直是false,看看是否是文件打开没有关
    java后台调用url无协议
    MyEclipse怎么设置个性化代码注释模板
    sql参数化查询in的参数
    mongodb索引
    oracle分配权限:一个用户访问另一个用户的表
    spring读写分离
  • 原文地址:https://www.cnblogs.com/dfg727/p/5619762.html
Copyright © 2020-2023  润新知