{"id":15292195,"url":"https://github.com/alfiosalanitri/wordpress-local-tunnel","last_synced_at":"2026-01-20T14:34:10.298Z","repository":{"id":255584689,"uuid":"852423650","full_name":"alfiosalanitri/wordpress-local-tunnel","owner":"alfiosalanitri","description":"This repository contains a Docker project that allows you to expose your locally WordPress site online using Cloudflare Tunnel via TryCloudflare. Useful when you want to share a preview of the site under development with a client.","archived":false,"fork":false,"pushed_at":"2025-04-03T08:53:55.000Z","size":54,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-03T09:33:11.621Z","etag":null,"topics":["cloudflared","tunnel","wordpress"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alfiosalanitri.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-04T19:25:35.000Z","updated_at":"2025-04-03T08:53:49.000Z","dependencies_parsed_at":"2024-12-20T15:42:55.158Z","dependency_job_id":"b02521c7-dc88-46d8-8c55-4fdf99b7417f","html_url":"https://github.com/alfiosalanitri/wordpress-local-tunnel","commit_stats":null,"previous_names":["alfiosalanitri/wordpress-local-tunnel"],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/alfiosalanitri/wordpress-local-tunnel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alfiosalanitri%2Fwordpress-local-tunnel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alfiosalanitri%2Fwordpress-local-tunnel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alfiosalanitri%2Fwordpress-local-tunnel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alfiosalanitri%2Fwordpress-local-tunnel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alfiosalanitri","download_url":"https://codeload.github.com/alfiosalanitri/wordpress-local-tunnel/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alfiosalanitri%2Fwordpress-local-tunnel/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28604950,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T12:01:53.233Z","status":"ssl_error","status_checked_at":"2026-01-20T12:01:46.545Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloudflared","tunnel","wordpress"],"created_at":"2024-09-30T16:16:55.514Z","updated_at":"2026-01-20T14:34:10.275Z","avatar_url":"https://github.com/alfiosalanitri.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WordPress Local Tunnel with Docker and Cloudflare Argo\n\nThis repository contains a Docker Compose file that allows you to expose your locally developed WordPress site online using Cloudflare Tunnel via TryCloudflare.\n\nUseful when you want to share a preview of the site under development with a client.\n\n## Prerequisites\n\nBefore using this script, ensure you have the following installed:\n\n- [Docker and Docker Compose](https://www.docker.com/)\n\n## Features\n\n- **Cloudflare Tunnel:** Exposes your local WordPress site securely over the internet using Cloudflare's `cloudflared` service.\n- **Custom WordPress Installation:** Mounts the WordPress installation directory specified in the `.env` file into the Docker container.\n- **Database Copy \u0026 URL Replacement:**\n    - Automatically extracts the database credentials from your `wp-config.php` or import the custom dump.sql file inside the `import` directory (placed manually).\n    - Creates a copy of your local WordPress database (or use the provided dump file) and imports it into the Docker MySQL instance.\n    - Uses the [Search Replace DB](https://github.com/interconnectit/search-replace-db) script to replace the local URL (specified in `WORDPRESS_LOCAL_URL` in the `.env` file) with the dynamic URL generated by Cloudflare Tunnel.\n\n## Important Note\n\nMake sure that the two variables in the .env file `WORDPRESS_MYSQL_HOST` and `WORDPRESS_MYSQL_PORT` are correct and that the MySQL server is reachable, or alternatively, manually place the previously exported dump.sql file into the import folder.\n\n## Local vs. Online Access\n\n- **Local Access:** Your WordPress site is accessible only from your local machine at the URL specified in your `.env` file, for example: `https://www.example.local`.\n- **Online Access:** Once the script is run, Cloudflare Tunnel will provide a dynamic public URL that exposes your site online, such as: `https://dynamic-random-string.trycloudflare.com`. This URL allows anyone to access your WordPress site from anywhere on the internet.\n\n## Getting Started (how to use)\n\n1. **Clone the Repository:**\n\n```bash\ngit clone https://github.com/alfiosalanitri/wordpress-local-tunnel.git #or download the package zip from latest release\n\ncd wordpress-local-tunnel\n```\n\n2. **Configure Your Environment:**\n\nCopy the `.env.example` file to `.env` and modify it according to your setup:\n\n```bash\ncp .env.example .env\n```\n\nEdit the `.env` file to set the following configurations:\n\n- `COMPOSE_PROJECT_NAME`: Prefix for Docker container names (e.g., `example_preview`).\n- `WORDPRESS_LOCAL_URL`: The local URL of your WordPress site (e.g., `https://www.example.local`).\n- `WORDPRESS_INSTALL_DIR`: Path to your local WordPress installation directory (e.g., `/var/www/www.example.local/public_html`).\n- `WORDPRESS_MYSQL_HOST`: Local MySQL server host from which to export the WordPress installation dump.\n- `WORDPRESS_MYSQL_PORT`: Local MySQL server port from which to export the WordPress installation dump.\n- `DB_DUMP_ARGS`: Custom dump export options like --column-statistics=0\n- `WORDPRESS_DEBUG`: true or false to enable or disable WORDPRESS_DEBUG\n- `WORDPRESS_DEBUG_LOG`: true or false to enable or disable WORDPRESS_DEBUG_LOG\n- `WORDPRESS_DEBUG_DISPLAY`: true or false to enable or disable WORDPRESS_DEBUG_DISPLAY\n- `WEB_DOCKER_PORT`: Port that exposes Apache in Docker (e.g., `8081`).\n- `WEB_DOCKER_USER`: User that runs the application inside the Docker container (e.g., `www-data`).\n- `MYSQL_DOCKER_PORT`: Port for MySQL in Docker (e.g., `3310`).\n- `MYSQL_DOCKER_ROOT_USER`: Root user for the MySQL instance (e.g., `root`).\n- `MYSQL_DOCKER_ROOT_PASSWORD`: Root password for the MySQL instance (e.g., `root`).\n- `MYSQL_DOCKER_DATABASE`: Name of the database used in Docker (e.g., `${COMPOSE_PROJECT_NAME}`).\n\n3. **Database (optional):**\n\nPlace the `dump.sql` file into the **import** folder if you prefer or if the automatic dump from the first step fails for any reason.\n\n4. **Start the Tunnel:**\n\n```bash\n./go.sh\n```\n\nThis will:\n\n- Export your local WordPress database (or use the provided dump file inside import directory) and import it into the Docker MySQL instance.\n- Create a backup of the wp-config.php file.\n- Create the wp-config.php file with Docker credentials.\n- Start MySQL, Apache, and PHP using Docker.\n- Mount your WordPress directory into the Docker container.\n- Run `cloudflared` to expose your local WordPress site online.\n- Replace the old url WORDPRESS_LOCAL_URL with the new Cloudflare url https://...trycloudflare.com\n\n5. **Visit the Site:**\n\nThe script will output a URL provided by Cloudflare, such as `https://dynamic-random-string.trycloudflare.com`, which you can use to access your WordPress site from anywhere.\n\n## Stopping the Tunnel and clear all\n\nTo stop the running Docker containers and the Cloudflare Tunnel, use:\n\n```bash\n./go.sh --stop\n```\n\n## Troubleshooting\n\n- **Port Conflicts:** Make sure the ports used in the Docker containers (e.g., 3310 for MySQL, 8081 for Apache) are not in use by other services on your machine.\n- **Cloudflare Errors:** If you encounter issues with Cloudflare, ensure you have a stable internet connection and that Cloudflare's service is not down.\n- **Database dump issue:** If the first step database_dump fails because it cannot connect to the database for the automatic dump, make sure that the host WORDPRESS_MYSQL_HOST and the user saved in wp-config.php are allowed remote access. On the host machine that houses the Wordpress database, access MySQL and create the user if not already present. Example: \n    ```\n    # replace \u003cval\u003e with the correct values\n    CREATE USER '\u003cDB_USER\u003e'@'\u003cWORDPRESS_MYSQL_HOST\u003e' IDENTIFIED WITH mysql_native_password BY '\u003cDB_PASSWORD\u003e';\n    # grant permissions to all or a specific database if preferred\n    GRANT ALL ON *.* TO '\u003cDB_USER\u003e'@'\u003cWORDPRESS_MYSQL_HOST\u003e';\n    ```\n    Alternatively, export the database manually and copy it to the import folder.\n\n## Contributing\n\nContributions are welcome! Feel free to submit issues, fork the repository, and create pull requests.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Acknowledgments\n\n- Thanks to [Cloudflare](https://www.cloudflare.com/) for providing the tunneling service.\n- This project uses [Docker](https://www.docker.com/) to manage the local WordPress environment.\n- Special thanks to [Search Replace DB](https://github.com/interconnectit/search-replace-db) for the URL replacement script used in this project.\n\n## Tested Environments\n\nThis script has been tested in a Linux environment. Compatibility with other operating systems may vary.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falfiosalanitri%2Fwordpress-local-tunnel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falfiosalanitri%2Fwordpress-local-tunnel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falfiosalanitri%2Fwordpress-local-tunnel/lists"}