Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/danielberndt/local-macos-php-development
https://github.com/danielberndt/local-macos-php-development
Last synced: about 19 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/danielberndt/local-macos-php-development
- Owner: danielberndt
- Created: 2020-04-10T12:01:32.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-01-24T11:56:11.000Z (12 months ago)
- Last Synced: 2024-11-18T17:45:22.922Z (2 months ago)
- Language: Dockerfile
- Size: 5.86 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# What does it do?
Assume all your wordpress/php projects are located within a `_Sites` folder.
Put this repo into the parent directory and execute the steps below. You'll now be able to open http://[SUBDIRNAME].test into your browser and see the contents of `_Sites/SUBDIRNAME` rendered by php.# SETUP
## Start the docker container
- `docker-compose up`
this exposes php-apache via port 8056, the db contents are stored within the ./db folder. This makes it very easy to migrate the database from one machine to another by just copying file contents.## Setup dnsmasq
- `brew install dnsmasq`
- `sudo mkdir /etc/resolver`
- `sudo sh -c 'echo "nameserver 127.0.0.1" >> /etc/resolver/test'`
- `sudo sh -c 'echo "search_order 1" >> /etc/resolver/test'`
- `sudo brew services start dnsmasq`
- `cd $(brew --prefix)`
- `echo 'address=/test/127.0.0.1' >> etc/dnsmasq.conf`
- `sudo brew services start dnsmasq`- Restart the machine 😒 (or maybe `dscacheutil -flushcache` works?)
> If there's a 5s delay before resolving local domains, add 127.0.0.1 as the first entry into the DNS Servers within your Network settings
Now `[anydomain].test` will be forwarded to localhost.
## Setup caddy
- `brew install caddy`
- create a `/usr/local/etc/Caddyfile` with these contents
```
http://*.test {
reverse_proxy 127.0.0.1:8056
}
```
- `brew services start caddy`Now `[anydomain].test` will be forwarded to `[anydomain].test:8056` where the docker container above will be awaiting.