标签:
netstat -lnpt //查看正在运行的服务端口 netstat -nlpt |grep mysql //看mysql运行端口 iptables -F //关闭防火墙 reboot //重启服务器 -------------------- 安装lnmp环境 1、yum update 检查一下系统更新 初次安装可能更新的时间会比较长,请耐心等待。 2、yum install gcc gcc-c++ ;安装gcc软件编译环境。 3、yum erase httpd ;卸载系统自带的httpd (apache2.2.3) 4、yum install zlib-devel libtool ncurses-devel libxml2-devel (zlib-devel 安装apache需要,否则出错 .libtool安装mysql时候需要.同时附带了autoconf automake imake 编译mysql 5.1.48时候会出错 需要autoconf重新配置一下) -------------- 安装 mysql yum install mysql msql-sever mysql-devel (*) 启动mysql 没设置密码 默认用 mysql进入 use mysql UPDATE user SET Password=PASSWORD(‘13456‘) WHERE user=‘root‘; //设置密码 FLUSH PRIVILEGES; GRANT ALL PRIVILEGES ON *.* TO xiaosu@"%" IDENTIFIED BY "123456"; //需要在新建一个 单独的用户供外部链接 flush privileges; //MySQL服务默认只允许从服务器本机连接,如果需要从远程连接,还需要在MySQL中设置相应的权限,并更新权限表 创建一个用户管理数据库 mysql > create database demo mysql >GRANT ALL PRIVILEGES ON demo.* TO ‘guest‘@‘localhost‘ IDENTIFIED BY ‘guest‘ WITH GRANT OPTION; mysql> UPDATE user SET Password=PASSWORD(‘guest‘) WHERE user=‘guest‘; ---------- 安装php yum install php php-mysql php-common php-gd php-mbstring php-mcrtpt php-devel php-xml yum install php php-mysql -y yum search php //搜索可用的php模块 --------- 安装apache yum -y install httpd chkconfig httpd on //设置开机启动 service httpd start //启动服务 yum install -y httpd-manual mod_ssl mod_perl mod_auth_mysql //安装其他扩展 netstat -lnpt //查看端口是否启动 #service httpd start #cd /var/www/html #vim index.php <?php phpinfo(); ?> ------ 安装nginx rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm yum clean all //清除yum缓存 yum install nginx //安装nginx 设置成开机启动: chkconfig httpd on chkconfig mysqld on ------ 配置nginx支持php cp /etc/nginx/nginx.conf /etc/nginx/nginx.confbak vi /etc/nginx/nginx.conf #修改nginx运行账号为:nginx组的nginx用户 user nginx nginx; cp /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.confbak vi /etc/nginx/conf.d/default.conf #增加index.php index index.php index.html index.htm; 取消FastCGI server部分location的注释,并要注意fastcgi_param行的参数,改为$document_root$fastcgi_script_name,或者使用绝对路径 location ~ \.php$ { # root html; fastcgi_pass 127.0.0.1:9000 ; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME html/$fastcgi_script_name; include fastcgi_params; } 第二个html要换成项目入口文件存放的目录 配置php-fpm cp /etc/php-fpm.d/www.conf /etc/php-fpm.d/www.confbak vi /etc/php-fpm.d/www.conf #修改用户为nginx user = nginx #修改组为nginx group = nginx 最后需要安装squid组件 //Squid代理服务器的安装与配置 yum -y install squid
标签:
原文地址:http://www.cnblogs.com/suxiaolong/p/5754093.html