web系统集成和安全(二)

2.mysql安装5.7以下
下载mysql选择source code。需要下载gcc-c++ ,ncurses, ncurses-devel, cmake,

增加程序用户:
Useradd –M –s /sbin/nologin mysql
编译安装
Cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql 主程序安装目录
-DSYSCONFDIR=/etc
-DDEFAULT_CHARSET=utf8 默认字符集为utf-8
-DDEFAULT_COLLATION=utf8_general_ci 默认的字符校对规则
-DWITH_EXTRA_CHARSETS=all 安装所有字符集

修改mysql安装目录的属猪
chown –R mysql:mysql /usr/local/mysql
添加系统服务
cp support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
mysqld –-add
mysqld –list
添加mysql命令执行的路径到PATH环境变量
echo “export PATH=$PATH:/usr/local/mysql/bin”>>/etc/profile
执行mysql_install_db脚本初始化数据库
/usr/local/mysql/scripts/mysql_install_db
–user=mysql 指定用户身份
–basedir=/usr/local/mysql 指定安装目录
–datadir=/usr/local/mysql/data/ 指定数据目录

一定要保证data目录的属主是mysql:mysql
chown –R mysql:mysql mysql
3.安装php模块
./configure
–prefix=/usr/local/php
–with-config-file-path=/usr/local/php/etc
–with-apxs2=/usr/local/apache2/bin/apxs
–with-pdo-mysql=/usr/local/mysql/
–with-libxml-dir=/usr/local/libxml2/
–with-png-dir=/usr/local/libpng/
–with-jpeg-dir=/usr/local/jpeg/
–with-freetype-dir=/usr/local/freetype/
–with-gd=/usr/local/gd/
–with-zlib-dir=/usr/local/zlib/
–with-mcrypt=/usr/local/libmcrypt/
–with-mysqli=/usr/local/mysql/bin/mysql_config
–enable-soap 变量激活soap和web service支持
–enable-mbstring=all 使多字节字符串知识
–enable-sockets 变量激活socket通信特性

1、#vim /etc/httpd/httpd.conf
找到:AddType application/x-gzip .gz .tgz
在该行下面添加:AddType application/x-httpd-php .php
2、找到:

DirectoryIndex index.html

将该行改为:

DirectoryIndex index.html index.htm index.php

3、找到:ServerName www.example.com:80
修改为:ServerName localhost:80
4、不改会出现403错误

2.4以下版本

Deny from all => Allow from all

2.4及以上的

Require all denied => Require all granted

里面用了很多人的知识,是整合过得,感谢很多人的博客。

猜你喜欢

转载自blog.csdn.net/weixin_40810386/article/details/80005831