Laravel NGINX:从位置到端口的反向代理
在Laravel NGINX:从位置到端口的反向代理,laravel,nginx,Laravel,Nginx,在/etc/nginx/sites available/x.x.x.conf上,我有以下条目: location /myapp { alias /var/www/html/myapp/public; index index.php; try_files $uri $uri/ @myapp; location ~* \.php$ { fastcgi_split_path_info ^(.+\.php)
/etc/nginx/sites available/x.x.x.conf
上,我有以下条目:
location /myapp {
alias /var/www/html/myapp/public;
index index.php;
try_files $uri $uri/ @myapp;
location ~* \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename$fastcgi_script_name;
fastcgi_read_timeout 7200;
}
}
location @myapp {
rewrite /myapp/(.*)$ /myapp/index.php?/$1 last;
}
目前我访问我的网站至x.x.x.x/myapp
如何将其代理给x.x.x.x:8059?我不确定是否理解您的问题。为什么ppl不发布他们的服务器块?无论如何,我都会尝试:
location /myapp/
{
proxy_pass http://x.x.x.x:8059/;
}
或者反过来说:
server
{
listen 8059;
server_name x.x.x.x example.org www.example.org;
# …
location /
{
proxy_pass http://x.x.x.x:80/myapp/;
}
}
现在你的道路很容易被打破。在代码中更改它们,或查看动态更改的proxy\u redirect
和sub(s)\u filter
浏览器->键[F12]->控制台和/或网络总是有用的
在Windows上也很不错:安装Git,打开Git Bash,然后做一个
curl-IL
在一天结束时,我在.conf
上创建了一个新的服务器条目,它可以完美地工作。谢谢