Loading
0

Linux下编译安装Nginx+PHP+Mysql方法及步骤
被墙跳转TG:@qianhenetwork QQ 851617266

301免备案跳转微信公众号
腾讯云服务器大促销。
华为服务器

该方法只是大概步骤,

文件安装路径:
nginx:/home/nginx
mysql:/home/mysql
php:/home/php5.6
========================
nginx:
安装依赖包:yum -y install pcre pcre-devel openssl openssl-devel gcc-c++
useradd nginx -s /sbin/nologin -M
./configure –user=nginx –group=nginx –prefix=/home/nginx/ –with-http_stub_status_module –with-http_ssl_module
make && make install

echo “/home/nginx/sbin/nginx” >>/etc/rc.local #开机自启动
=========================
php:

下载php版本和libiconv,
编译安装/usr/local/libiconv
./configure –prefix=/usr/local/libiconv
make && make install
安装依赖包
php编译:
/configure –prefix=/home/php5.6 –with-mysql=mysqlnd –with-pdo-mysql=mysqlnd –with-mysqli=mysqlnd –with-openssl –enable-mbstring –with-freetype-dir –with-jpeg-dir –with-png-dir –with-zlib –with-libxml-dir=/usr –enable-xml –enable-sockets –with-mcrypt –with-bz2 –enable-fpm –with-gd –enable-bcmath
make && make install

启动php:/home/php5.6/sbin/php-fpm (将php的运行权限更改为nginx,否则会没有权限解析php)

echo “/home/php5.6/sbin/php-fpm” >>/etc/rc.local  #开机自启动
在nginx站点配置文件中添加如下代码:
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
========================
mysql:
下载mysql解压到home目录下,然后执行如下命令初始化mysql
useradd mysql -s /sbin/nologin -M
/home/mysql/scripts/mysql_install_db –basedir=/home/mysql –datadir=/home/mysql/data
/home/mysql/support-files/my-default.cnf /etc/my.cnf
/bin/cp /home/mysql/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld

将配置文件中/usr/local/mysql改成/home/mysql /etc/init.d/mysqld
将配置文件中/usr/local/mysql改成/home/mysql /home/mysql/bin/mysqld_safe
chown mysql.mysql /home/mysql -R
service mysqld restart

echo “export PATH=/home/mysql/bin:$PATH” >>/etc/profile

source /etc/profile

SET PASSWORD FOR root=PASSWORD(west999); 设置root密码
=========================
创建数据库命令:

create database kaoshiba;
grant all privileges on kaoshiba.* to kaoshiba@localhost identified by ‘abc999’;

=========================

301免备案跳转微信公众号
华为服务器
腾讯云服务器大促销。

声明:站长码字很辛苦啊,转载时请保留本声明及附带文章链接:https://www.zfcdn.xyz/showinfo-3-374-0.html
亲爱的:被墙域名跳转TG:@qianhenetwork QQ:851617266,可否收藏+评论+分享呢?
上一篇:[转]Linux系统防CC攻击自动拉黑IP增强版Shell脚本
下一篇:重启网卡Device eth0 has different MAC address than expected 错误处理方法