Setting up laravel Project into Nginx Reverse Proxy - laravel

I have a problem setting up Laravel Project into my Nginx Reverse Proxy
I had proxy pass my laravel project into nginx reverse-proxy.conf
Here is my configuration in reverse-proxy.conf
location ^~ "/pys/" {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Cookie $http_cookie;
proxy_pass http://XXX.XX.X.X:1228/;
}
When I run into my browser, with my url XXX.XXX.X.XX/pys it will redirect to login page,
after entering the credentials, the page returns 404 not found and with the URL of XXX.XXX.X.XX only and all the routes in Laravel Project is affected.
Is there any possibility that I can fix the URL with /pys ?
Thank you

Related

How to remove author filter from SonarQube issue overview

I was asked by my workers council to remove the author and assignee filter from the SonarQube issues page. I'm using SonarQube version 6.7.7 (build 38951).
Currently I don't see any option to configure this. Is there any option to remove the filter? I know that I can disable to analysis of of the SCM commits at all, but I want to keep the my issues feature and the notification on new issue.
Unfortunately, it is impossible by using only SonarQube (check the proposal about the nginx proxy configuration) and won't be implemented. Read more details here: SONAR-11028 Turning off developer nominative information/metrics.
Finally we are now using a workaround that filters certain requests to the SonarQube API with an nginx reverse proxy.
Here is a configuration example:
events {
worker_connections 1024;
}
http {
server {
listen 80;
listen [::]:80;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://sonarqube:9000;
}
location /api/issues/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_set_header Accept-Encoding "";
proxy_pass http://sonarqube:9000;
sub_filter_once off;
sub_filter_types application/json;
sub_filter 'authors' 'XXXXXXXXXX';
sub_filter 'assignees' 'XXXXXXXXXX';
}
}
}

Creating proxy_pass from cloudfront to ec2 instanse

I'm want to create move our front end setup on CloudFront and s3.
I got an application with a static web site with an nginx that proxy_pass the host header to another port on the same machine (as seen in the code below).
location /api {
proxy_pass http://my_app:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
client_max_body_size 1000M;
server_tokens off;
After I uploaded my frontend to s3 and configured CloudFront origin to go to the s3 static web server how do I configure the Origin Settings & Cache Behavior Settings to send the header to the ec2 instance as shown in the current Nginx config?

How to configure tomcat into two different domains in one application?

I wanted to split my applications so that I can configure Tomkat into two different domains "example.com" and "api.example.com". Is it possible to do this with one application? So that some requests are processed on subdomain.
Sure, you can multiple domains of redirecting to multiple Tomcat applications. You would need to install the applications in your Tomcat and make them listen for different ports. Then if you were to use Nginx, all you have to do is change the server clause in your /sites-enabled/ directory from your installation. For your case, you will need two files, one for each domain.
FILE 1
server {
server_name example.com;
location / {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8080;
}
}
FILE 2
server {
server_name api.example.com;
location / {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8081;
}
}
You can find more information in the following url.

How can configure the Magento 2 With Varnish Cache with HTTPS

Thank you for looking on this.
I have a Magento 2.1.8 website and it will run on the Amazon EC2 with this https://aws.amazon.com/marketplace/pp/B007OUYR4Y Amazon AMI.
I have optimized everything on Magento 2 website but did not get the proper result on this.
I have tried to use the Varnish cache but it is not working with the HTTPS.
anyone have an idea, how can use the varnish with the HTTPS to optimize the website speed.
Varnish Cache does dot speak HTTPS natively. You'll need an SSL terminator such as Hitch, HAProxy, etc. deployed in front of Varnish, ideally using the PROXY protocol.
With my setups I use NGINX as a proxy to handle both http and https requests and then use Varnish as the backend so NGINX handles all the SSL certificates.
Here's an example of my NGINX ssl template:
server {
listen server-ip:443 ssl;
server_name example.com www.example.com;
ssl_certificate /home/user/conf/web/ssl.example.com.pem;
ssl_certificate_key /home/user/conf/web/ssl.example.com.key;
location / {
proxy_pass http://varnish-ip:6081;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Nginx on;
proxy_redirect off;
}
location #fallback {
proxy_pass http://varnish-ip:6081;
}
}

env['REMOTE_ADDR'] with Goliath ruby

I have an API with Goliath gem (ruby) and I want to get the ip of the movile which is calling to my API. The case is, env['REMOTE_ADDR'] always give me 127.0.0.1 when some device is calling me. It shoud be the ip from the mobile is calling me, right?
Any help please?
Thanks in advance!
The problem was with proxying through Nginx. I had to change the Nginx proxy configuration as follows.
upstream app_xxx {
server 127.0.0.1:3000;
}
server {
listen 80;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_pass http://app_xxx;
}
}
The important thing is: The real IP is in the X-Real-IP parameter. So you have to access it as:
env['X-Real-IP']

Resources