Comments (2)
Another alternative that I think would be reasonable, not to have a folder in the project root that would only be used in development environments and not be omitting it in .gitignore, it would be to pass through an environment variable the value of the virtual host. In this way, the default configuration of the docker-compose.yml
file is maintained.
In my case, I used the same APP_SERVER
environment variable that Sail uses to refer to the virtual host, I passed it to the template of the NGINX configuration.
./.env
APP_SERVICE=anis.test
./docker-compose.yml
services:
nginx:
environment:
- SSL_PORT=${SSL_PORT:-443}
- APP_SERVICE=${APP_SERVICE:-laravel.test}
anis.test:
build:
context: ./vendor/laravel/sail/runtimes/8.1
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
image: sail-8.1/app
....
nginx/templates/default.conf.template
server {
listen 80 default_server;
server_name localhost;
return 301 https://$host:${SSL_PORT}$request_uri;
}
server {
listen 443 ssl default_server;
server_name localhost;
# Self signed certificates
# Don't use them in a production server!
ssl_certificate /etc/nginx/certs/server.pem;
ssl_certificate_key /etc/nginx/certs/server.key;
location / {
proxy_pass http://${APP_SERVICE};
}
}
from sail-ssl.
You can publish Nginx configuration file by this command:
$ php artisan sail-ssl:publish
Then you can change server_name
directive
nginx/templates/default.conf.template
server {
listen 80 default_server;
server_name laravel.test;
return 301 https://$host:${SSL_PORT}$request_uri;
}
server {
listen 443 ssl default_server;
server_name laravel.test;
# Self signed certificates
# Don't use them in a production server!
ssl_certificate /etc/nginx/certs/server.pem;
ssl_certificate_key /etc/nginx/certs/server.key;
location / {
proxy_pass http://laravel.test;
}
}
from sail-ssl.
Related Issues (14)
- I can access site but login with Breeze fail? HOT 1
- Certificate location error when installing the project on some other computer HOT 3
- Certificate becomes invalid. HOT 1
- Issue with custom port? HOT 7
- There are no commands defined in the "sail-ssl" namespace. HOT 1
- No commands in sail-ssl namespace HOT 1
- Issue with certificate loading HOT 5
- how to config vite?
- Your connection is not private HOT 6
- Bind for 0.0.0.0:443 failed: port is already allocated
- Missing custom http(s) port HOT 1
- Navigator shows 'Not secure' HOT 2
- Does not work in Laravel 10 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sail-ssl.