Nginx Laravel Php每个请求双请求
我的Laravel5.1站点部署在NGINX服务器上,Ubuntu上有PHP7,我的站点有问题。当我请求路由时,请求被复制,我在尝试一个功能时注意到了这一点,我必须通过生成一个新的令牌(如CSRF令牌)来防止重复请求,但每个请求都要生成一个新的令牌 编辑 我找到了问题的症结所在,这对我来说是最不可想象的 带有asset thing的img标记导致在nginx ubuntu上发生双重请求, 我在与logger和google进行了更多的调试后发现了这个问题,有人建议这可能是favicon的问题,所以我尝试删除html并发现了这个问题 这张照片表面上并不存在。 “” 当我尝试对任何控制器中的函数进行Nginx Laravel Php每个请求双请求,laravel,ubuntu,nginx,request,laravel-5.1,Laravel,Ubuntu,Nginx,Request,Laravel 5.1,我的Laravel5.1站点部署在NGINX服务器上,Ubuntu上有PHP7,我的站点有问题。当我请求路由时,请求被复制,我在尝试一个功能时注意到了这一点,我必须通过生成一个新的令牌(如CSRF令牌)来防止重复请求,但每个请求都要生成一个新的令牌 编辑 我找到了问题的症结所在,这对我来说是最不可想象的 带有asset thing的img标记导致在nginx ubuntu上发生双重请求, 我在与logger和google进行了更多的调试后发现了这个问题,有人建议这可能是favicon的问题,所以
Log::info(“test”)
时,我得到以下结果:
[2017-08-03 19:46:39] local.INFO: test
[2017-08-03 19:46:39] local.INFO: test
不过,我的本地WAMP apache服务器上没有这个问题
站点可用配置(符号链接到已启用的站点)
Show nginx config,Show kernel.php(我不确定L5.1是否有kernel.php,您注册中间件的主文件)。您是指站点可用的配置文件?您是自己配置nginx还是使用了某种教程?是,发布您的站点配置文件。还可以尝试执行
Log::info('before');dd(“无论什么”)代码>并查看它的功能。如果你在之前得到,在之前你知道有一些web服务器(NGINX)配置错误,如果你在之前得到,你知道PHP/Laravel/App做了一些奇怪的事情。当在Log::info(“before”)之后添加dd时,我得到过一次,编辑了post。你最近更新了服务器软件或PHP包吗?(composer-update
或sudo-apt-get-update
&…升级
)。
server {
listen 80;
listen [::]:80;
server_name mysite.com www.mysite.com;
return 301 https://$server_name$request_uri;
}
server {
# SSL configuration
listen 443 ssl; # managed by Certbot
listen [::]:443 ssl;
ssl_certificate /etc/letsencrypt/live/mysite.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/mysite.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
error_page 401 403 404 /404.html;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /var/www/mysite/site/public;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name mysite.com www.mysite.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php?$query_string;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # With php7.0-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php7.0-fpm:
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
location /pma {
auth_basic "Auth required";
auth_basic_user_file /etc/nginx/pma_pass;
root /var/www/html;
index index.php index.html index.htm;
location ~ ^/pma/(.+\.php)$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~* ^/pma/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /var/www/html;
}
}
}