docker compose laravel swag
-
Step 1: Wire up swag to your existing docker-compose multi container schema. When your ready flip your staging directive to true so you don't timeout your certbot by mistake if you are steadily destroying containers and remaking them.
Add the following to the docker-compose.yml services directive:
swag: image: linuxserver/swag container_name: swag cap_add: - NET_ADMIN environment: - PUID=1000 - PGID=1000 - TZ=America/New_York - URL=advisory.nyc - SUBDOMAINS=wizdev, - VALIDATION=http - ONLY_SUBDOMAINS=true #optional - STAGING=false #optional volumes: - ./swag:/config ports: - 443:443 - 80:80 restart: unless-stopped
swag:
image: linuxserver/swag
container_name: swag
cap_add:
- NET_ADMIN
environment:
- PUID=1000
- PGID=1000
- TZ=America/New_York
- URL=advisory.nyc
- SUBDOMAINS=wizdev,
- VALIDATION=http
- ONLY_SUBDOMAINS=true #optional
- STAGING=false #optional
volumes:
- ./swag:/config
ports:
- 443:443
- 80:80
restart: unless-stopped
- Step 2
Change the .env file to explicitly say site_location http:///somesite.you.com, anddocker-compose run artisan config:clear
external assets will get blocked unless you do the following steps
-
Step 3
Add this to the boot() function inside ofapp/Providers/RouteServiceProvider.php
/** @var \Illuminate\Routing\UrlGenerator $url */ $url = $this->app['url']; // Force the application URL $url->forceRootUrl(config('app.url'));
/** @var \Illuminate\Routing\UrlGenerator $url */ $url = $this->app['url']; // Force the application URL $url->forceRootUrl(config('app.url'));
-
Step 4
Open all proxies inapp/Http/Middleware/TrustProxies.php
by changing this directive to a star dot starprotected $proxies = '**';
protected $proxies = '**';
src: https://laravel.com/docs/5.5/requests#configuring-trusted-proxies
-
Step 5 add your proxy pass block with your proto scheme to your nginx.conf
location / { proxy_pass http://wizdev.advisory.nyc:8080/; 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 $scheme; # try_files $uri $uri/ /index.html /index.php?$args =404; }
location / {
proxy_pass http://wizdev.advisory.nyc:8080/;
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 $scheme;
# try_files $uri $uri/ /index.html /index.php?$args =404;
}