纠结166服务器的配置环境参考
2013-11-07 21:45
351 查看
首先该文件为公司服务器实体配置文档。
首先是安装CentOS6.4_86x64
安装软件为mini 最小化安装 安装勾选为:基础、java、prel 开发 默认设置未进去勾选
安装完成后,开始lamp环境搭建;选用yum安装5分钟搞定。php版本5.3.3
首先:开启防火墙端口:80 3306
2关闭selinux
3.查看是否已经存在httpd mysql php
4保证环境是干净的以后开始安装,当然我的是最小化安装时不需要查看的
5安装mysql
6安装php 和php的支持包
重启下
/etc/init.d/mysqld restart #重启MySql
/etc/init.d/httpd restart #重启Apche
环境安装到此结束。
Apache 配置:
配置php
vim /etc/php.ini
网站更目录权限的设置:
权限设置:chown apache.apache -R /opt/web/
chmod -R 775 /opt/web/
lsof -i:80
netstat -apl | grep httpd
netstat -apl | grep mysqld
echo "<? phpinfo(); ?>" > /opt/web/index.php
重启apache 浏览器浏览 ip地址:
首先是安装CentOS6.4_86x64
安装软件为mini 最小化安装 安装勾选为:基础、java、prel 开发 默认设置未进去勾选
安装完成后,开始lamp环境搭建;选用yum安装5分钟搞定。php版本5.3.3
首先:开启防火墙端口:80 3306
[root@localhost ~]# cat /etc/sysconfig/iptables # Firewall configuration written by system-config-firewall # Manual customization of this file is not recommended. *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
2关闭selinux
[root@localhost ~]# cat /etc/selinux/config # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. #SELINUX=enforcing SELINUX=disabled # SELINUXTYPE= can take one of these two values: # targeted - Targeted processes are protected, # mls - Multi Level Security protection. #SELINUXTYPE=targeted 注释掉: #SELINUX=enforcing #SELINUXTYPE=targeted 修改为 SELINUX=disabled
3.查看是否已经存在httpd mysql php
rpm -qa | grep httpd rpm -qa | grep mysql rpm -qa | grep php
4保证环境是干净的以后开始安装,当然我的是最小化安装时不需要查看的
yum -y install httpd /etc/init.d/httpd start ##启动apache 备注:Apache启动之后会提示错误: 正在启动 httpd:httpd: Could not reliably determine the server's fully qualif domain name, using ::1 for ServerName 解决办法: vi /etc/httpd/conf/httpd.conf #编辑 找到 #ServerName www.example.com:80 修改为 ServerName localhost:80 #这里设置为你自己的域名,如果没有域名,可以设置为localhost :wq! #保存退出 chkconfig httpd on #设为开机启动 /etc/init.d/httpd restart #重启Apache
5安装mysql
yum -y install mysql mysql-server /etc/init.d/mysqld start #启动mysql chkconfig mysqld on #设置开机启动 cp /usr/share/mysql/my-medium.cnf /etc/my.cnf #拷贝配置文件(注意:如果/etc目录下面默认有一个my.cnf,直接覆盖即可) 2.为root用户设置密码 mysql_secure_installation ##运行 mysql_secure_installation 回车,根据提示输入Y 输入2次密码,回车 根据提示一路输入Y 注意!:Disallow root login remotely? [Y/n] (是否禁止root的远程登录)N 最后出现:Thanks for using MySQL! MySql密码设置完成,重新启动 MySQL: /etc/init.d/mysqld restart #重启 /etc/init.d/mysqld stop #停止 /etc/init.d/mysqld start #启动 用远程软件连接下mysql 如果连接不上可以用一下步骤: mysql -u root -p :password mysql>grant all on *.* to root@’%’ identified by ‘password′; mysql>quit /etc/init.d/mysqld restart
6安装php 和php的支持包
[root@localhost ~]# yum -y install php php-pdo php-ncurses php-bcmath php-odbc php-dba php-devel php-pear php-gd php-pgsql php-ldap php-soap php-mbstring php-xml php-mysql php-xmlrpc libjpeg* php-imap php-mcrypt php-bcmath php-mhash libmcrypt
重启下
/etc/init.d/mysqld restart #重启MySql
/etc/init.d/httpd restart #重启Apche
环境安装到此结束。
Apache 配置:
DirectoryIndex index.html 添加index.php Listen 80 ##下面增加 137 Listen 81 (137为行号) DocumentRoot "/opt/" 我的网站放在/opt/下 <Directory "/opt/"> 这里也设置下 NameVirtualHost *:80 开启虚拟主机 下面是放了两个基于端口的虚拟主机 <VirtualHost *:80> ServerAdmin webmaster@dummy-host.example.com DocumentRoot /opt/web/www/ ServerName dummy-host.example.com ErrorLog logs/dummy-host.example.com-error_log CustomLog logs/dummy-host.example.com-access_log common </VirtualHost> <VirtualHost *:81> ServerAdmin 1webmaster@dummy-host.example.com DocumentRoot /opt/web/www2/ ServerName dummy-host.example.com #ErrorLog logs/dummy-host.example.com-error_log #CustomLog logs/dummy-host.example.com-access_log common </VirtualHost>
KeepAlive Off 在76行 修改为:KeepAlive On (允许程序性联机) MaxKeepAliveRequests 100 在83行 修改为:MaxKeepAliveRequests 1000 (增加同时连接数) :wq! #保存退出 /etc/init.d/httpd restart #重启 rm -f /etc/httpd/conf.d/welcome.conf /var/www/error/noindex.html #删除默认测试页
配置php
vim /etc/php.ini
date.timezone = PRC #在946行 把前面的分号去掉,改为date.timezone = PRC 修改为中国时间 在386行 列出PHP可以禁用的函数,如果某些程序需要用到这个函数,可以删除,取消禁用 expose_php = Off #在432行 禁止显示php版本的信息 magic_quotes_gpc = On #在745行 打开magic_quotes_gpc来防止SQL注入 short_open_tag = ON #在229行支持php短标签 :wq! #保存退出 /etc/init.d/mysqld restart #重启MySql /etc/init.d/httpd restart #重启Apche
网站更目录权限的设置:
权限设置:chown apache.apache -R /opt/web/
chmod -R 775 /opt/web/
lsof -i:80
netstat -apl | grep httpd
netstat -apl | grep mysqld
echo "<? phpinfo(); ?>" > /opt/web/index.php
重启apache 浏览器浏览 ip地址:
![](http://images.cnitblog.com/blog/533312/201311/07214748-c9085bf8c1d94d3e86ccc87fa93e318e.png)
相关文章推荐
- ubuntu服务器环境配置参考
- 本地plsql登录进去,提示:服务器字符集和客户端字符集不一致。但是我注册表没有设置字符集、环境变量也没有配置NLS_LANGUAGE环境变量,plsql是怎么识别的客户端编码呢?
- JAVA环境变量和TomCat服务器配置
- 安装程序配置服务器失败。参考服务器错误日志和 C:/WINDOWS/SQLSTP.LOG 了解更多信息
- 搭建公网服务器及配置深度学习环境
- 阿里云服务器下配置SQLite工作环境
- Windows7、Windows2008服务器 IIS7.0环境配置伪静态
- 【Linux 操作系统】阿里云服务器 操作实战 部署C语言开发环境(vim配置,gcc) 部署J2EE网站(jdk,tomcat)
- 腾讯云服务器CentOS6.5 配置 -- LAMP(appache,mysql,php)环境设置
- 阿里云ECS服务器Linux环境下配置php运行环境(安装配置篇)
- Windows操作系统下 Tomcat 服务器运行 PHP 的环境配置
- LNMP(linux+nginx+mysql+php)服务器环境配置
- LNMP(linux+nginx+mysql+php)服务器环境配置
- 【技术小记 | 服务器】Linux环境下Apache2配置多个虚拟主机
- LNMP(linux+nginx+mysql+php)服务器环境配置
- 最近因为项目需要,所以配置了linux下面的eclipse平台配置opencv3.0的环境,参考了一些正真有用的网页,记录
- Windows server 2003 服务器环境配置 新手简明版
- Windows环境下用Apache+PHP+MySql配置web服务器
- 详细的图文教程来实现 eclipse环境下如何配置tomcat,并且把项目部署到Tomcat服务器上
- CentOS7服务器环境下vsftpd安装及配置方法