centos6: mysql+nginx+php

Posted dfg727

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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 [email protected]%identified by password;
    
php:
    tar -zxvf php-5.6.23.tar.gz -C /usr/local/src
    cd php-5.6.23
    mkdir -p /usr/local/php5
    ./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc --with-gd --with-iconv --with-zlib --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-pear --with-gettext --enable-session --with-mcrypt --with-curl
    make 
    make install
    cp php.ini-production /usr/local/php5/etc/php.ini
    rm -rf /etc/php.ini
    ln -s /usr/local/php5/etc/php.ini /etc/php.ini
    cp /usr/local/php5/etc/php-fpm.conf.default /usr/local/php5/etc/php-fpm.conf 
    vi /usr/local/php5/etc/php-fpm.conf    
    pid = run/php-fpm.pid #取消前面的分号
    cp /usr/local/src/php-5.5.10/sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm#拷贝php-fpm到启动目录
    chmod +x /etc/rc.d/init.d/php-fpm #添加执行权限
    chkconfig php-fpm on #设置开机启动
    vi /usr/local/php5/etc/php.ini #编辑配置文件
    修改为:date.timezone = PRC #设置时区
    
    vim /etc/profile
        export PATH=$PATH:/usr/local/php5/bin
    source /etc/profile
    
    
nginx:
    sudo salt-call --local state.sls nginx saltenv="local"
    
    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:
    Composer: http://pkg.phpcomposer.com/        
        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
        
    Laravel: https://github.com/johnlui/Learn-Laravel-5/issues/4

 

以上是关于centos6: mysql+nginx+php的主要内容,如果未能解决你的问题,请参考以下文章

centos6 LNMP的搭建(linux+nginx+mysql+php)

CentOS6.5安装php7+nginx+mysql实现安装WordPress

CentOS6.3上安装与配置nginx+php+mysql环境

Dockerfile创建Linux/CentOS6.x Nginx MySQL Tomcat PHP(LNMTP)镜像

CentOS6.8编译安装Nginx1.10.2+MySQL5.7.16+PHP7.0.12

LNMP环境搭建(centos6.9+mysql5.7+php7.1+nginx1.9)