legend2---lamp.sh一键安装lamp环境需要爬的坑
一、总结
一句话总结:
1、要记得更改项目权限:chown -R apache:apache /data/www/default/网站域名/
2、mysql中root@localhost和root@127.0.0.1不是同一个用户
3、遇到bug不用急,用脑子好好分析,很容易解决的
1、lamp.sh一键安装好lamp环境之后,从git中git clone把项目拖下来后,配置好apache,出现Forbidden:You don't have permission to access / on this server.?
忘记了更改权限:安装流程里面说的很清楚,以为自己装过一遍就忘记看了:更改网站目录权限。以 root 用户登录,运行:chown -R apache:apache /data/www/网站域名/
[root@iZbp162rpl6gfqbrngoyr0Z www]# ll total 8 drwxr-xr-x 5 apache apache 4096 Jul 25 07:08 default drwxr-xr-x 5 root root 4096 Jul 25 06:21 legend2 [root@iZbp162rpl6gfqbrngoyr0Z www]# chown -R apache:apache /data/www/legend2 [root@iZbp162rpl6gfqbrngoyr0Z www]# ll total 8 drwxr-xr-x 5 apache apache 4096 Jul 25 07:08 default drwxr-xr-x 5 apache apache 4096 Jul 25 06:21 legend2
2、apache中一个服务器下面放多个站点(lamp.sh安装时候的看到)?
IfModule alias_module:比如 Alias /kod /data/www/default/kod
<IfModule alias_module> Alias /phpmyadmin /data/www/default/phpmyadmin </IfModule> <IfModule alias_module> Alias /kod /data/www/default/kod </IfModule>
3、apache一个域名对应多个站点的简便方法?
IfModule alias_module:比如 Alias /kod /data/www/default/kod
<IfModule alias_module> Alias /phpmyadmin /data/www/default/phpmyadmin </IfModule> <IfModule alias_module> Alias /kod /data/www/default/kod </IfModule>
4、就算是放在default(/data/www/default)目录下,也要chown来修改权限,不然会有各种莫名其妙的权限错误的(比如 mkdir(): Permission denied错误)?
以 root 登录后,运行:chown -R apache:apache /data/www/default/网站域名/
5、网站放在default下行,放在default的平行目录不行,应该怎么做?
看安装说明 + 需要修改一下apache的默认配置
将/usr/local/apache/conf/extra/httpd.conf中的"/data/www/default"替换为"/data/www"即可
#DocumentRoot "/data/www/default" #<Directory "/data/www/default"> DocumentRoot "/data/www" <Directory "/data/www"> # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.4/mod/core.html#options # for more information. # Options Indexes FollowSymLinks # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # AllowOverride FileInfo AuthConfig Limit # AllowOverride None # # Controls who can get stuff from this server. # Require all granted </Directory>
6、linux下修改mysql用户密码?
set password for root@localhost = password('123');
用SET PASSWORD命令
首先登录MySQL:mysql -hlocalhost -uroot -p
格式:mysql> set password for 用户名@localhost = password('新密码');
例子:mysql> set password for root@localhost = password('123');
7、为什么 set password for root@localhost = password('123'); 修改密码后tp5报SQLSTATE[HY000] [1045] Access denied for user 'root'@'127.0.0.1' (using password: YES)错误?
因为root@localhost和root@127.0.0.1不是同一个用户,打开mysql的用户就可以发现
8、mysql命令基础操作?
1、登录:mysql -hlocalhost -uroot -p
2、显示所有数据库:show databases;
3、显示某个数据库中的所有表:use legend2; show tables;
4、显示某个表中的数据:select * from lg_user;
9、lamp.sh在linux下部署网站步骤?
1、安装好lamp.sh
按照lamp.sh网站的安装教程安装lamp:www.lamp.sh
2、github上面把网站代码拉过来
git clone 网址
3、修改网站文件夹的权限
chown -R apache:apache /data/www/default/网站域名/
4、如果不是放在default目录下,就需要修改apache配置:将"/data/www/default" 改成 "/data/www"
#DocumentRoot "/data/www/default"
#<Directory "/data/www/default">
DocumentRoot "/data/www"
<Directory "/data/www">
10、查找linux下php的配置文件再哪?
sudo find / -name php.ini
二、lamp.sh在linux下部署网站步骤:
1、安装好lamp.sh
按照lamp.sh网站的安装教程安装lamp:www.lamp.sh
2、github上面把网站代码拉过来
git clone 网址
3、修改网站文件夹的权限
chown -R apache:apache /data/www/default/网站域名/
4、如果不是放在default目录下,就需要修改apache配置
将"/data/www/default"改成"/data/www"
#DocumentRoot "/data/www/default" #<Directory "/data/www/default"> DocumentRoot "/data/www" <Directory "/data/www"> # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.4/mod/core.html#options # for more information. # Options Indexes FollowSymLinks # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # AllowOverride FileInfo AuthConfig Limit # AllowOverride None # # Controls who can get stuff from this server. # Require all granted </Directory>