Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to configure /etc/host domain on OSX development machine #2380

Closed
jvv8 opened this issue Nov 20, 2019 · 2 comments
Closed

How to configure /etc/host domain on OSX development machine #2380

jvv8 opened this issue Nov 20, 2019 · 2 comments

Comments

@jvv8
Copy link

jvv8 commented Nov 20, 2019

Info:

  • Docker version: Docker version 19.03.5
  • System info (Mac):
  • System info: Nginx

Issue:

After running docker-compose up -d nginx mysql phpmyadmin redis I can access the site through the browser with http://localhost
However, I plan on running several docker containers with different configurations in my development environment such as:
http://project-a.test
http://project-b.test

I've loaded Laradock within the project directory with git submodule add ... and gave a unique name in the .env file for 'COMPOSE_PROJECT_NAME'

Created the conf file for the site in: docker-project/laradock-docker-project/nginx/sites/docker-project.conf
`

server {
listen 80;
listen [::]:80;

# For https
# listen 443 ssl;
# listen [::]:443 ssl ipv6only=on;
# ssl_certificate /etc/nginx/ssl/default.crt;
# ssl_certificate_key /etc/nginx/ssl/default.key;

server_name docker-project.test;
root /var/www/docker-project/public;
index index.php index.html index.htm;

location / {
     try_files $uri $uri/ /index.php$is_args$args;
}

location ~ \.php$ {
    try_files $uri /index.php =404;
    fastcgi_pass php-upstream;
    fastcgi_index index.php;
    fastcgi_buffers 16 16k;
    fastcgi_buffer_size 32k;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    #fixes timeouts
    fastcgi_read_timeout 600;
    include fastcgi_params;
}

location ~ /\.ht {
    deny all;
}

location /.well-known/acme-challenge/ {
    root /var/www/letsencrypt/;
    log_not_found off;
}

error_log /var/log/nginx/docker-project_error.log;
access_log /var/log/nginx/docker-project_access.log;

}
`

Using OSX, I edited /etc/hosts which is also running homestead for some previous projects:


127.0.0.1       localhost
127.0.0.1       docker-project.test
192.168.10.10       homestead-app.test

Visiting http://localhost pulls up the docker-project
Visiting http://docker-project.test results in '404 Not Found (nginx)'


Expected behavior:

Visiting http://docker-project.test should pull up the docker project served with nginx

Unfortunately, the only way to access the development site is with "http://localhost" which limits the ability to develop multiple websites with laradock.

What am I missing?


@jvv8 jvv8 changed the title How to configure host domain on development machine How to configure /etc/host domain on OSX development machine Nov 20, 2019
@pabloleone
Copy link

Check that root /var/www/docker-project/public; of your VH file is really pointing to the Laravel public folder!

@jvv8
Copy link
Author

jvv8 commented Nov 21, 2019

Thanks, edited .env

# Point to where the `APP_CODE_PATH_HOST` should be in the container
APP_CODE_PATH_CONTAINER=/var/www/docker-project

And it now docker-project.test pulls up.

@jvv8 jvv8 closed this as completed Nov 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants