Laravel从Homestead开发环境移到Ubuntu生产环境(1) - Ubuntu16.04 生产环境安装

1. 参考 https://github.com/summerblue/laravel-ubuntu-init

其中会遇到问题:Error in `appstreamcli': double free or corruption (fasttop): 0x0000000002122000

解决办法:https://blog.csdn.net/taosera/article/details/78148845

 

2. 之后按照laravel-ubuntu-init里面的创建站点项目monitor,再创建sql的root用户名,默认生成一串难记的密码,为了和自己的项目匹配,按照下贴修改mysql的root用户名的密码:

https://www.cnblogs.com/roadofstudy/p/7446690.html

其中最关键的几条命令:

> use mysql;

update user set authentication_string=PASSWORD("这里输入你要改的密码"where User='root'; #更改密码

update user set plugin="mysql_native_password"; #如果没这一行可能也会报一个错误,因此需要运行这一行

> flush privileges; #更新所有操作权限

> quit;

 

3. 修改/etc/hosts,添加

127.0.0.1    monitor.com
127.0.0.1    localhost

为了让输入localhost和127.0.0.1以及monitor.com都坊问的是monitor这个站点而不是default站点,要将nginx.conf里面包括的default的server信息去掉,

gedit nginx.conf

将include /etc/nginx/sites-enabled/*;

换成:

include /etc/nginx/sites-enabled/monitor.conf;

 

4. 在/etc/nginx/sites-enable下面有两个配置文件,一个是default,一个是创建monitor站点时生成的monitor.conf。折腾了很久始终无法通过monitor.com的域名访问自己的monitor站点,最后发现是server_name monitor.com后面少打了一个分号。

編辑完monitor.conf之后要重启一下nginx:  service nginx reload

gedit sites-enabled/monitor.conf

server {
    listen 80;
    server_name monitor.com;
    root /var/www/monitor/public;

    index index.html index.htm index.php;

    charset utf-8;

    location / {
    #root /var/www/monitor/public;
        try_files $uri $uri/ /index.php?$query_string;

    #add_header Cache-Control no-cache;
    #add_header Cache-Control private;
    #expires 0s;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log /var/log/nginx/monitor.log;
    error_log /var/log/nginx/monitor-error.log error;

    sendfile off;

    client_max_body_size 100m;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        fastcgi_param DOCUMENT_ROOT $realpath_root;

        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;
        fastcgi_connect_timeout 300;
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;
    }

    location ~ /\.ht {
        deny all;
    }
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值