小编Mau*_*sas的帖子

强制WWW在AWS EC2负载均衡器后面

我想出了一个小问题,我们正在为一个新项目使用负载均衡器,但我们不能强制使用www.没有请求之间的重定向循环.

我们目前正在使用NGINX,要重定向的代码段如下:


LOAD BALANCER NGINX CONFIG

# FORGE CONFIG (DOT NOT REMOVE!)
include forge-conf/mywebsite.com/before/*;

# FORGE CONFIG (DOT NOT REMOVE!)
include upstreams/mywebsite.com;

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    server_name .mywebsite.com;

    if ($host !~* ^www\.){
        rewrite ^(.*)$ https://www.mywebsite.com$1;
    }

    # FORGE SSL (DO NOT REMOVE!)
    ssl_certificate /etc/nginx/ssl/mywebsite.com/225451/server.crt;
    ssl_certificate_key /etc/nginx/ssl/mywebsite.com/225451/server.key;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

    charset utf-8;

    access_log off;
    error_log  /var/log/nginx/mywebsite.com-error.log error;

    # FORGE CONFIG (DOT NOT REMOVE!)
    include forge-conf/mywebsite.com/server/*;

    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto …
Run Code Online (Sandbox Code Playgroud)

nginx amazon-ec2 amazon-web-services

10
推荐指数
1
解决办法
227
查看次数

Laravel 模型事件 update() 未触发

class Profile extends Eloquent {

    protected $fillable = array('name', 'last_name', 'website', 'facebook', 'twitter', 'linkedin', 'google_plus');

    public static function boot(){
        parent::boot();

        self::updating(function($model){
            $model->name = Crypt::encrypt($model->name);
            $model->last_name = Crypt::encrypt($model->last_name);
            $model->facebook = Crypt::encrypt($model->facebook);
            $model->twitter = Crypt::encrypt($model->twitter);
            $model->linkedin = Crypt::encrypt($model->linkedin);
            $model->website = Crypt::encrypt($model->website);
            $model->google_plus = Crypt::encrypt($model->google_plus);
        });
    }
}
Run Code Online (Sandbox Code Playgroud)

我也在使用调用事件..

$user->profile()->update(array(
    'name' => e($input['name']),
    'last_name' => e($input['last_name']),
    'website' => e($input['website']),
    'facebook' => e($input['facebook']),
    'twitter' => e($input['twitter']),
    'linkedin' => e($input['linkedin']),
    'google_plus' => e($input['google_plus'])
));
Run Code Online (Sandbox Code Playgroud)

由于某种原因,它没有触发任何事件...我试图在将用户信息保存到数据库之前对其进行加密

php eloquent laravel-4

5
推荐指数
2
解决办法
9200
查看次数