DEV Community

Discussion on: Deploying Your Laravel App on Docker, With NGINX and MySQL

Collapse
 
tombombadilll profile image
Thomas Eriksson

Hi, great tutorial. Could you show how you add a domain name to this. I have tried a lot but didn't get it working. Eg. example.dev.com.

I have several sites and want to use a domain instead of localhost:8990

Thanks!

Collapse
 
baliachbryan profile image
Brian Baliach

Hello there Thomas!

If your multiple sites are on different domains, then you need make sure that your server supports cross-origin requests (since these requests are blocked by default by browsers). You can find a very comprehensive tutorial online.

Meanwhile,
Using our nginx server, go to the vhost.conf file we just created, and edit the server_name directive. Modify it to be your domain name and save. At this point, I assume that you have changed your A records and pointed your domain to your server's IP address. Leave the listen port to be 80 (and 443 if you have ssl). Save your configurations and re-create your docker container.