Azure Openlogic centos7.1 上搭建lnmp环境

Azure Openlogic centos7.1 上搭建lnmp环境

第一步:依赖包安装:

yum -y install gcc gcc-c++ autoconf cmake libjpeg libjpeg-devel libpng \
libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel \
glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel \
curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel \
openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients \
openldap-servers gd gd2 gd-devel gd2-devel perl-CPAN

第二步:安装mariadb:

centos 后续版本yum中不再有mysql提供,而是由mariadb顶替。

mariadb的安装,直接使用yum命令:

yum search mariadb    命令可以看到所有可用mariadb包

mariadb-bench.x86_64 : MariaDB benchmark scripts and data
mariadb-devel.i686 : Files for development of MariaDB/MySQL applications
mariadb-devel.x86_64 : Files for development of MariaDB/MySQL applications
mariadb-embedded.i686 : MariaDB as an embeddable library
mariadb-embedded.x86_64 : MariaDB as an embeddable library
mariadb-embedded-devel.i686 : Development files for MariaDB as an embeddable library
mariadb-embedded-devel.x86_64 : Development files for MariaDB as an embeddable library
mariadb-libs.i686 : The shared libraries required for MariaDB/MySQL clients
mariadb-libs.x86_64 : The shared libraries required for MariaDB/MySQL clients
mariadb-server.x86_64 : The MariaDB server and related files
mariadb.x86_64 : A community developed branch of MySQL
mariadb-test.x86_64 : The test suite distributed with MariaD
yum install mariadb-devel.x86_64
yum install mariadb-server.x86_64


添加mariadb的yum源到文件 /etc/yum.repos.d/MariaDB.repo中

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1.4/centos7-amd64/
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

保存后执行:

sudo yum install MariaDB-server MariaDB-client


期间如果报错,重复执行。


service mysql start    启动数据库服务

ps -ef|grep mysql    查看mysql进程

netstat -tanp    查看mysqld是否监听3306端口


到azure控制面板,把3306端口打开(创建终结点)。


执行命令:mysqladmin -u root -p password ss   将root密码改为ss(初始是空)


执行命令:GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '000000' WITH GRANT OPTION;    为root用户授予远程登录权限(登录密码是 000000)。



第三步:安装nginx

安装wget工具:yum install wget

获取rpm文件:wget  http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

安装yum仓库:rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm

安装nginx: yum -install nginx

启动nginx:service start nginx


第四步:安装php-fpm

yum install php-fpm

启动php:service php-fpm start


至此安装已完成。

svn 检出:

svn checkout svn://123.com/wwwroot/ . --username zoudeming    (svn地址后面加空格+.  表示检出这个目录下的所有文件,但不包括根目录)。

配置


1、使nginx连接到php-fpm,配置nginx配置文件、/etc/nginx/conf.d/ss.conf

server {
        listen 80;
        server_name  www.baidu.com;
        root /usr/share/nginx/ss;
        index index.php;
        location /uploads/* {
        }
        location / {
        try_files $uri $uri/ /index.php?$query_string;
        }
        location ~ \.php$ {
                include /etc/nginx/fastcgi_params;
                fastcgi_pass  127.0.0.1:9000;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }
}


2、安装mcrypt,它依赖libmcrypt,装完lib之后,mcrypt在configure时通常报错:

>export LD_LIBRARY_PATH=/usr/local/lib:LD_LIBRARY_PATH
>./configure –with-libmcrypt-prefix=/usr/local
>make && make install

3、安装php-mcrypt:

wget http://museum.php.net/php5/php-5.4.16.tar.gz
tar -xvzf php-5.4.16.tar.gz
cd php-5.4.16/ext/mcrypt
phpize
php-config
./configure
make && make install
vi /etc/php.ini
添加:extension=mcrypt.so


4、如果要让环境支持laravel,必须安装composer

php -r "readfile('https://getcomposer.org/installer');" | php




















你可能感兴趣的:(Azure Openlogic centos7.1 上搭建lnmp环境)