centos6.5下使用yum完美搭建lnmp环境(php5.6) -凯发k8官方网
凯发k8官方网
收集整理的这篇文章主要介绍了
centos6.5下使用yum完美搭建lnmp环境(php5.6)
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
2019独角兽企业重金招聘python工程师标准>>>
准备工作 配置防火墙,开启80端口、3306端口 删除原有的 iptables , 添加合适的配置 rm -rf /etc/sysconfig/iptablesvi /etc/sysconfig/iptables 添加如下内容 : ################################ 添加好之后防火墙
准备工作配置防火墙,开启80端口、3306端口 添加如下内容 : ################################ 添加好之后防火墙规则如下所示################################ # 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 -a input -j reject --reject-with icmp-host-prohibited -a forward -j reject --reject-with icmp-host-prohibited commit #######################################################################################:wq保存退出, 重启防火墙使配置生效 /etc/init.d/iptables restart关闭selinux rm -rf /etc/selinux/config vi /etc/selinux/config添加一行内容: selinux=disabled:wq保存退出 #重启系统 shutdown -r now开始安装一. 安装nginx#删除系统自带的软件包 yum remove httpd* php* #安装nginx yum install -y nginx #设置nginx开机启动 chkconfig nginx on #启动nginx service nginx start二. 安装php三. 安装 mysql配置1. 配置nginxrm -rf /etc/nginx/conf.d/* vi /etc/nginx/conf.d/default.conf添加如下内容 : server{listen 80;server_name _;index index.php index.html index.htm;root /var/www;location ~ .*\.(php|php5)?${#fastcgi_pass unix:/tmp/php-cgi.sock;fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;include fastcgi.conf;}location / {try_files $uri $uri/ /index.php?$query_string;} }说明: /var/www 为web根目录, location / ... 为url的rewrite,隐藏 index.php 2. 配置php-fpmvi /etc/php-fpm.d/www.conf将用户和用户组设置为nginx, 如: #修改用户为nginx user = nginx#修改组为nginx group = nginx开始测试cd /var/www vi index.php添加以下代码 :wq! 保存退出 #设置权限 chown nginx.nginx /var/www -r #重启nginx service nginx restart #重启php-fpm service php-fpm restart在客户端浏览器输入服务器ip地址(如: 127.0.0.1),可以看到相关的配置信息! |
转载于:https://my.oschina.net/u/593517/blog/805898
总结
以上是凯发k8官方网为你收集整理的centos6.5下使用yum完美搭建lnmp环境(php5.6)的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: linux 网卡信息查看
- 下一篇: spring集成 jediscluste