Centos7 Lnmp Laravel
2015-11-25 17:15
507 查看
准备
1、安装Centos 7 X64 Minimal 版
2、关闭firewall:
systemctl stop firewalld.service #停止firewall systemctl disable firewalld.service #禁止firewall开机启动
3、更新 yum 源,自带的源没有 PHP5.6 :
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm[/code]4、安装iptables防火墙
yum install iptables-services #安装 vi /etc/sysconfig/iptables #编辑防火墙配置文件更改配置如下:# sample configuration for iptables service # you can edit this manually or use system-config-firewall # please do not ask us to add additional ports/services to this default configuration *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT -A INPUT -p tcp -m state --state NEW -m 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保存,重启防火墙,设置开机启动systemctl restart iptables.service #最后重启防火墙使配置生效 systemctl enable iptables.service #设置防火墙开机启动5、关闭SELINUX
vi /etc/selinux/config#SELINUX=enforcing #注释掉 #SELINUXTYPE=targeted #注释掉 SELINUX=disabled #增加setenforce 0 #使配置立即生效6、更新下系统
yum update -y安装
1、安装 Nginx :
yum install nginx18 -ysystemctl start nginx.service #启动nginx systemctl stop nginx.service #停止nginx systemctl restart nginx.service #重启nginx systemctl enable nginx.service #设置nginx开机启动2、安装MariaDB(CentOS 7.0中,已经使用MariaDB替代了MySQL数据库)
安装yum install mariadb mariadb-server -y #安装 systemctl start mariadb.service #启动MariaDB systemctl stop mariadb.service #停止MariaDB systemctl restart mariadb.service #重启MariaDB systemctl enable mariadb.service #设置开机启动cp /usr/share/mysql/my-huge.cnf /etc/my.cnf #拷贝配置文件(注意:如果/etc目录下面默认有一个my.cnf,直接覆盖即可)设置Root密码mysql_secure_installation #回车,根据提示输入Y #输入2次密码,回车 #根据提示一路输入Y #最后出现:Thanks for using MySQL! #MariaDB密码设置完成,重新启动 MariaDB: systemctl restart mariadb.service #重启MariaDB3、安装 PHP :
yum install php56w-fpm php56w-mysql php56w-mysqli php56w php56w-opcache php56w-gd php56w-intl php56w-mbstring php56w-exif php56w-mcrypt php56w-openssl -ysystemctl start php-fpm.service #启动php-fpm systemctl stop php-fpm.service #停止php-fpm systemctl restart php-fpm.service #重启php-fpm systemctl enable php-fpm.service #设置开机启动配置
1、配置 php-fpm :
vi /etc/php-fpm.d/www.conf #修改user和group user = nginx group = nginx2、配置 Nginx:
把配置文件里面的 server{ ****}这部分替换成下面这段就可以了server { listen 80; server_name example.com; location / { root /usr/share/nginx/html/laravel/public; try_files $uri $uri/ /index.php?$query_string; index index.php index.html index.htm; } error_page 404 /404.html; location = /404.html { root /usr/share/nginx/html/laravel/public; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html/laravel/public; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { root /usr/share/nginx/html/laravel/public; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }3、权限问题一定要处理好。。。
相关文章推荐
- 理解Linux系统负荷
- CentOS安装Subversion 1.9.*版本客户端
- Linux中只列出目录
- Linux下查看文件和文件夹大小
- Linux系统设置定时任务
- VIM入门配置
- CentOS 6 安装epel源
- 虚拟机linux与主机时间同步
- Linux下修改Mysql的用户(root)的密码
- PYTHON多进程并发WEB服务器(利用LINUX的FORK)
- Linux下发包处理
- linux下 查看外网IP命令
- CentOS下修复grub引导程序
- 误卸载linux自带的rpm包
- Linux上vi(vim)编辑器使用教程
- linux 查看文件夹大小
- linux下的mysql乱码问题
- Linux下 RabbitMQ的安装与配置
- 全面解析Linux 内核 3.10.x - Device Tree 详解
- 让linux支持EC11等旋转编码器