<?php
==========================lamp环境与框架搭建======================================
apt-get update
apt-get install apache2 php5 php5-mysql redis-server curl php5-curl php5-gd php5-cli mcrypt php5-mcrypt git php5-xdebug openssl php5-openssl
apt-get install mysql-client mysql-server (输入密码)
apt-get install phpmyadmin (执行 ln -s /usr/share/phpmyadmin/ /var/www/ 然后建虚拟主机)这样才可以访问phpmyadmin
打开模块:
sudo php5enmod mcrypt (查看:php -i | grep mcrypt )
a2enmod rewrite (开启rewrite:重写模块)
查看开启的端口 : sudo php -m
修改 :vi /etc/apache2/apache2.conf
<Directory />
Options FollowSymLinks
AllowOverride all // 修改为all
Require all denied
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride all // 修改为all
Require all granted
</Directory>
文件中加入(防止每次启动服务报错,错误如下):ServerName localhost
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 10.172.228.147. Set the 'ServerName' directive globally to suppress this message [ OK ]
开启php错误调试:vi /etc/php5/apache2/php.ini
error_reporting = E_ALL
display_errors = On
修改配置:vi /etc/hosts 【如果修改访问这个网址会访问本地的,如果不修改则访问的是网络的】
127.0.0.1 localhost
127.0.1.1 mvc.com
127.0.1.1 laravel.com
虚拟主机(复制文件即可后缀以 .conf 结尾):
cp /etc/apache2/sites-enabled/000-default.conf /etc/apache2/sites-enabled/useryx.conf
vi /etc/apache2/sites-enabled/useryx.conf
修改(laravel使用):DocumentRoot /var/www/useryx/public/
添加(线上环境,线下可以不用):ServerName www.useryx.com
phpAdmin mv /etc/apache2/sites-enabled/000-default.conf /etc/apache2/sites-enabled/phpmyadmin.conf
同useryx.com 绑定一下域名修改以下路径。
apache端口:vi /etc/apache2/ports.conf
apache2的操作命令:
启动:sudo /etc/init.d/apache2 start
重启:sudo /etc/init.d/apache2 restart
关闭:sudo /etc/init.d/apache2 stop
或者重启apache: service apache2 restart
lamp环境与框架搭建
最新推荐文章于 2023-11-14 00:09:26 发布