标签:程序 ref AC echo ttf server 语法 get too
1、部署linux系统2、部署nginx服务
(1)依赖软件包安装 yum install -y pcre-devel openssl-devel
(2)创建虚拟管理用户 useradd -M -s /sbin/nologin nginx
(3)下载并解压nginx软件
cd /server/tools;wget http://nginx.org/download/nginx-1.12.2.tar.gz; tar -xf nginx-1.12.2.tar.gz
(4)编译安装nginx软件
./configure --prefix=/application/nginx-12.2 --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module
make;make install
(5)创建软链接目录
ln -s /application/nginx-12.2 /application/nginx
(6)启动nginx服务
/application/nginx/sbin/nginx -t 测试语法
/application/nginx/sbin/nginx
3、部署Mysql服务
(1)下载并解压mysql软件程序
软件包过大,在windows下载好后,通过xftp上传
cd /server/tools;tar -xf mysql-5.6.34-linux-glibc2.5-x86_64.tar.gz
mv mysql-5.6.34-linux-glibc2.5-x86_64 /application/mysql-5.6.34
(2)创建软件程序软链接
ln -sf /application/mysql-5.6.34/ /application/mysql
(3)创建数据库管理用户,并授权数据目录
useradd mysql -M -s /sbin/nologin
chown -R mysql.mysql /application/mysql/data/
(4)对数据库服务进行初始化(两个ok就是成功)
/application/mysql/scripts/mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data/ --user=mysql
(5)启动mysql服务
cp /application/mysql/support-files/mysql.server /etc/init.d/mysqld
sed -ri ‘s#/usr/local#/application#g‘ /etc/init.d/mysqld /application/mysql/bin/mysqld_safe
cp /application/mysql/support-files/my-default.cnf /etc/my.cnf
/etc/init.d/mysqld start
(6)设置数据库root用户登录密码
/application/mysql/bin/mysqladmin -uroot password "oldboy123"
/application/mysql/bin/mysql -uroot -poldboy123
4、部署php服务
(1)第一里程:解决PHP软件的依赖关系
yum install -y zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel
libiconv软件安装---字符集转换库(注意: yum库中没有)
cd /server/tools
#wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar zxf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/usr/local/libiconv
make
make install
(2)第二个里程:下载解压PHP软件
php官方网站下载:php.net
cd /server/tools/
tar xf php-5.5.32.tar.gz
cd php-5.5.32
./configure \
--prefix=/application/php-5.5.32 \
--with-mysql=/application/mysql-5.6.34 \
--with-pdo-mysql=mysqlnd \
--with-iconv-dir=/usr/local/libiconv \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir=/usr \
--enable-xml \
--disable-rpath \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--enable-mbregex \
--enable-fpm \
--enable-mbstring \
--with-mcrypt \
--with-gd \
--enable-gd-native-ttf \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-soap \
--enable-short-tags \
--enable-static \
--with-xsl \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-ftp \
--enable-opcache=no
##防错(以下信息可以不进行配置了)
ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64/
touch ext/phar/phar.phar
make
make install
ln -s /application/php-5.5.32/ /application/php
(3)第三个里程:设置PHP程序配置文件
php.ini php-fpm.ini
cp /server/tools/php-5.5.32/php.ini-production /application/php/lib/
cd /application/php/etc/
cp php-fpm.conf.default php-fpm.conf
(4)第四个里程:启动php程序服务
/application/php/sbin/php-fpm
netstat -lntup|grep php
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 6251/php-fpm
5、进行软件间的结合
(1)nginx与php结合
注:通过location定位uri资源信息
location ~ ..(php|php5)?$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
测试方法:
vim /application/nginx/html/blogs/test_info.php
<?php
phpinfo();
?>
(2)php与mysql结合
php与mysql结合:编写php程序代码
vim /application/nginx/html/blogs/test_mysql.php
<?php
//$link_id=mysql_connect(‘主机名‘,‘用户‘,‘密码‘);
//mysql -u用户 -p密码 -h 主机
$link_id=mysql_connect(‘localhost‘,‘root‘,‘oldboy123‘) or mysql_error();
if($link_id){
echo "mysql successful by tangyong !\n";
}else{
echo mysql_error();
}
?>
6、部署一个真的网站
(1)第一个里程:下载与上传网站代码
(2) 第二个里程:解压程序代码,将程序代码保存到站点目录并进行授权
tar xf wordpress-4.7.3-zh_CN.tar.gz
mv wordpress/ /application/nginx/html/blog/
chown -R nginx.nginx /application/nginx/html/blog/ 注:修改成和nginx worker进程相同的用户
(3)第三个里程:直接访问blog网站,进行初始化操作
创建数据库:
create database wordpress;
show databases; 查看数据库
创建连接数据用户信息
grant all on wordpress. to ‘wordpress‘@‘localhost‘ identified by ‘oldboy123‘;
select user,host from mysql.user; 检查用户表,用户是否在表中
标签:程序 ref AC echo ttf server 语法 get too
原文地址:http://blog.51cto.com/tangyong/2133453