session共享的問題 參考Laravel使用Redis共享Sessionphp
server { listen 81; server_name _; index index.html index.htm index.php; access_log /data/wwwroot/wwwlogs/www_nginx.log combined; root /data/wwwroot/www/public; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ .*\.(php|php5)?$ { fastcgi_pass unix:/dev/shm/php-cgi.sock; fastcgi_index index.php; include fastcgi.conf; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ { expires 30d; access_log off; } location ~ .*\.(js|css)?$ { expires 7d; access_log off; } }
server { listen 80; server_name -; index index.html index.htm index.php; access_log /data/wwwlogs/www_nginx.log combined; root /data/wwwroot/www/public; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ .*\.(php|php5)?$ { fastcgi_pass unix:/dev/shm/php-cgi.sock; fastcgi_index index.php; include fastcgi.conf; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ { expires 30d; access_log off; } location ~ .*\.(js|css)?$ { expires 7d; access_log off; } }
upstream backend{ ip_hash; server 127.0.0.1:81; server 10.0.0.3; } server { listen 80; server_name www.c.com; index index.html index.htm index.php; access_log /data/wwwroot/wwwlogs/www_nginx.log combined; root /data/wwwroot/www/public; location / { proxy_pass http://backend; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location ~ .*\.(php|php5)?$ { fastcgi_pass unix:/dev/shm/php-cgi.sock; fastcgi_index index.php; include fastcgi.conf; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ { expires 30d; access_log off; } location ~ .*\.(js|css)?$ { expires 7d; access_log off; } }
若是是作微信公衆號,使用了easywechat,須要把backend 代換爲你的www.c.com 這樣才能支持微信受權。 微信的access_token須要使用redis共享,easywechat默認使用laravel 的緩存,因此須要把.env的緩存改爲使用redis CACHE_DRIVER=redis
css
public function boot() { \Request::setTrustedProxies(['127.0.0.1','10.0.0.2']); }