2年前的某条买了个服务器和域名,想督促自己多学习,建个有用的平台。然后钱花了,服务器上面还是空的。今天又立志开始捣鼓,因为做梦都想挣钱。挣钱自己就必须有能力,几年过去了,想法一直在,能力却一直没有提高。
开始捣鼓服务器,就从配置服务器开始。服务器上安装一个【宝塔】,真心觉得【宝塔】让linux开发变得简单很多。搭建环境,配置环境都不用命令了。因为计划很多,想一个个开始就想先规划好。首先想从学习magento开始,需要建立一个子域名
主域名和子域名建立方法。
1、用【宝塔】【网站】下添加站点
提交之后,就自动在网站目录下创建了magento.xiongmaoxueyuan.com的文件夹
2、子域名解析
到域名控制台,解析域名
3、magento环境的搭建是真费事,看着上篇文章在服务器上搭建,还是会报不同的错误。唯一方便的是,可以使用宝塔添加php扩展了。
4、magento搭建完成后,访问前端显示正常。后端直接显示404
这是什么鬼啊!!!
觉得宝塔方便,宝塔就给我一个坑,网站需要设置伪静态
location / {
index index.html index.php; ## Allow a static html file to be shown first
try_files $uri $uri/ @handler;
expires 30d;
}
location /var/export/ { ## Allow admins only to view export folder
auth_basic "Restricted"; ## Message shown in login window
auth_basic_user_file htpasswd; ## See /etc/nginx/htpassword
autoindex on;
}
location /. { ## Disable .htaccess and other hidden files
return 404;
}
location @handler { ## Magento uses a common front handler
rewrite / /index.php;
}
location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
rewrite ^(.*.php)/ $1 last;
}