# 安装 centos
cd /etc/sysconfig/network-scripts/
vi ifcfg-xxx
# 修改 ONBOOT="no" 为 "yes"
# 修改 BOOTPROTO=dhcp 为 "static"
# 虚拟机切换成桥接模式
#########################
IPADDR=your ip
NETMASK=
GATEWAY=
DNS1=
#########################
# 可以不用执行 yum update -y
systemctl restart network && mv /etc/localtime /etc/localtime.bak && ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && yum install ntp -y && systemctl enable ntpd && vi /etc/sysconfig/ntpd
# 增加-g -x参数,允许ntp服务在系统时间误差较大时也能正常工作
service ntpd restart && yum install -y epel-release zip unzip vim wget ed mlocate && rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm && rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm && yum install -y php71w httpd mariadb mariadb-server php71w-mysql php71w-xml php71w-soap php71w-cli php71w-xmlrpc php71w-mbstring php71w-json php71w-gd php71w-mcrypt && systemctl enable httpd.service && systemctl enable mariadb.service && systemctl start httpd.service && systemctl start mariadb.service && systemctl start firewalld.service && firewall-cmd --zone=public --add-port=80/tcp --permanent && systemctl restart firewalld.service && mysqladmin -u root password
wget https://files.phpmyadmin.net/phpMyAdmin/4.6.4/phpMyAdmin-4.6.4-all-languages.tar.gz && tar xvfz phpMyAdmin-4.6.4-all-languages.tar.gz && rm -rf phpMyAdmin-4.6.4-all-languages.tar.gz && mv phpMyAdmin-4.6.4-all-languages /var/www/html/pmd && cd /var/www/html && cd pmd && cp config.sample.inc.php config.inc.php && vi config.inc.php
cd /var/www/html && curl -O https://getcomposer.org/installer && php installer && rm -f installer && mv composer.phar /usr/local/bin/ && composer.phar config -g repo.packagist composer https://packagist.phpcomposer.com && composer.phar create-project laravel/laravel && chmod -R 755 /var/www/html/laravel/storage /var/www/html/laravel/bootstrap/cache && chown -R apache.apache /var/www/html/laravel/storage /var/www/html/laravel/bootstrap/cache && cd /var/www/html/laravel && php artisan key:generate && php artisan make:auth && php artisan migrate && mv /var/www/html/pmd ./public && setenforce 0 && systemctl stop firewalld && vim /etc/httpd/conf/httpd.conf
1. 找到以下内容,
Include conf.modules.d/*.conf
在上面一行之后添加以下内容,
LoadModule rewrite_module modules/mod_rewrite.so
2. AllowOverride None # 改成 All
3. /var/www/html => /var/www/html/laravel/public
systemctl restart httpd && vim /var/www/html/laravel/config/database.php
# 修改 charset 和 collation 为 utf8 和 utf8_general_ci
vim /var/www/html/laravel/.env
# 在.env文件中设置如下
mysql 的 账户、密码、数据库
MAIL_DRIVER=smtp
MAIL_HOST=smtp.qq.com
MAIL_PORT=465
MAIL_USERNAME=00000000000@qq.com
MAIL_PASSWORD=填写授权码(在QQ邮箱设置-账户-POP3/IMAP/SMTP/Exchange/CardDAV/CalDAV服务-生成授权码)
MAIL_ENCRYPTION=ssl
# 在config/mail.php文件中设置如下
vim /var/www/html/laravel/config/mail.php
'from' => ['address' => '00000000000@qq.com', 'name' => 'Laravel5'],
从安装 centos 到运行 laravel
最新推荐文章于 2021-11-02 17:52:30 发布