文档详情

Linux网络操作系统配置与管理新增资源项目13拓展资源_在Centos下安装httpd课件.docx

发布:2017-06-03约2.6千字共4页下载文档
文本预览下载声明
在Centos下安装httpd、php、Mysql并配置 1、安装Apahce, PHP, Mysql, 以及php连接mysql库组件。 yum -y install httpd php mysql mysql-server php-mysql 2、 配置开机启动服务:设置apache服务器httpd服务开机启动、在服务清单中添加mysql服务、设置mysql服务开机启动 1) /sbin/chkconfig httpd on /sbin/chkconfig --add mysqld /sbin/chkconfig mysqld on 3、启动httpd服务、启动mysql服务 /sbin/service httpd start /sbin/service mysqld start 3、新建一个index.php文件,内容如下: ?php phpinfo(); ? 将该文本上传至默认站点目录为/var/www/html/中,并访问,即可测试服务信息! 4、设置mysql数据库root帐号密码。 mysqladmin -u root password newpassword     [引号内填密码] 5、让mysql数据库更安全 mysql -u root -p                     [此时会要求你输入刚刚设置的密码,输入后回车即可] mysql DROP DATABASE test;                [删除test数据库] mysql DELETE FROM mysql.user WHERE user = ;    [删除匿名帐户] mysql FLUSH PRIVILEGES;                 [重载权限] 6、 新建一个数据库,添加一个数据库用户,设置用户权限。 mysql CREATE DATABASE eexu_db; mysql GRANT ALL PRIVILEGES ON eexu_db.* TO user@localhost IDENTIFIED BY password; #eexu_db是数据库名称、user是用户名、password是密码,根据需要换成自已的 7、apache虚拟主机配置。 vi /etc/httpd/conf/httpd.conf 1)绑定域名: 添加下面内容: NameVirtualHost *:80 VirtualHost *:80 ServerName? HYPERLINK / \t _blank  ServerAlias *. DocumentRoot /www/domain /VirtualHost 2)设置默认文档 找到以下字符 DirectoryIndex index.html index.htm index.php 8、解决中文乱码问题。 vi /etc/httpd/conf/httpd.conf   找到AddDefaultCharset 改为  AddDefaultCharset off    这种方式关掉了服务器的默认语言的发送,这样仅凭html文件头中设置的语言来决定网页语言。有人直接用AddDefaultCharset GB2312,这种方式有问题看,虽然中文显示没问题了,但当你的网页内码不是GB2312,就算你在网页用下面的meta指定了正确的语言,如 ISO8859-1,也不会解码为ISO8859-1,因为Apache已经先你一步将GB2312指定为网页的语言了。 9、低内存服务器的MySQL内存占用优化建议,仅供参考。 配置文件: vi /etc/f [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock user=mysql # Default to using old password format for compatibility with mysql 3.x # clients (those using the mysqlclient10 compatibility package). old_passwords=1 # Low memory optimizations skip-bdb skip-innodb skip-networking server-id = 1 key_buffer = 256K max_allowed_packet=1M thread_stack = 64K table_cache = 4 sort_buffer_size = 64K read_buffer_size = 256K read_rnd_buffer_size = 256K net_buffer_
显示全部
相似文档