Answer the question
In order to leave comments, you need to log in
Why don't domains work in homestead?
Hey!
I decided to put homestead on my home PC under Linux - Elementary OS.
I installed everything, but I can't figure out why I can't connect to the project at "homestead.test" or "example.test".
But if I use the path http://192.168.10.10/test2/index.php
- everything works.
My Homestead.yaml:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Documents/dev/server
to: /home/vagrant/server
sites:
- map: example.test
to: /home/vagrant/server
databases:
- homestead
hosts
to addresses.198.168.10.10 homestead.test
198.168.10.10 example.test
server {
listen 80;
listen 443 ssl http2;
server_name .example.test;
root "/home/vagrant/server";
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log off;
error_log /var/log/nginx/example.test-error.log error;
sendfile off;
client_max_body_size 100m;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
}
location ~ /\.ht {
deny all;
}
ssl_certificate /etc/nginx/ssl/example.test.crt;
ssl_certificate_key /etc/nginx/ssl/example.test.key;
}
Answer the question
In order to leave comments, you need to log in
The folders
directive maps the root folder with projects, which is mapped from the host to the virtual machine. In your case, this is ~/Documents/dev/server - you should have all projects in this folder. The sites
directive contains a specific project folder mapping, where each domain corresponds to a project folder in the root folder of all projects (see above), i.e. /home/vagrant/server/ project . The path from here will be used in the server config in the root directive.
folders:
- map: ~/Documents/dev/server
to: /home/vagrant/server
sites:
- map: homestead.test
to: /home/vagrant/server/homestead
- map: example.test
to: /home/vagrant/server/example
~/Documents
- dev
- server (вот эту папку маунтим на виртуалку)
- homestead (конкретный проект)
- example (конкретный проект)
homestead up --provision
where did the test2 folder come from?
Neither Homestead.yml nor nginx config have this folder in their paths...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question