elementor / wp2static

WordPress static site generator for security, performance and cost benefits
https://wp2static.com
The Unlicense
1.43k stars 270 forks source link

Static export only has empty folders #180

Closed kykungz closed 5 years ago

kykungz commented 5 years ago

I'm very new to WordPress, and want to try using Wordpress Static Site Generator Plugin to create a .html files from my WordPress site. I was following this tutorial from https://docs.docker.com/compose/wordpress/ which uses docker-compose to create a simple WordPress site.

version: '3.3'

services:
   db:
     image: mysql:5.7
     volumes:
       - db_data:/var/lib/mysql
     restart: always
     environment:
       MYSQL_ROOT_PASSWORD: somewordpress
       MYSQL_DATABASE: wordpress
       MYSQL_USER: wordpress
       MYSQL_PASSWORD: wordpress

   wordpress:
     depends_on:
       - db
     image: wordpress:latest
     ports:
       - "8000:80"
     restart: always
     environment:
       WORDPRESS_DB_HOST: db:3306
       WORDPRESS_DB_USER: wordpress
       WORDPRESS_DB_PASSWORD: wordpress
volumes:
    db_data:

Then I go ahead and activate your plugin and got no html files:

mystaticsite
├── contents
│   └── ui
│       └── theme
│           └── assets
│               ├── css
│               ├── images
│               └── js
├── hello-world
├── inc
└── sample-page

Any help?

EDIT: here is some information from docker-compose that might be useful:

wordpress_1_72dc1c77882a | 172.23.0.1 - - [28/Nov/2018:15:47:56 +0000] "POST /wp-admin/admin-ajax.php?_fs_blog_admin=true HTTP/1.1" 200 457 "http://localhost:8000/wp-admin/admin.php?page=wp-static-html-output" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36"
wordpress_1_72dc1c77882a | [Wed Nov 28 15:47:56.548979 2018] [php7:notice] [pid 219] [client 172.23.0.1:47346] error in wp_remote_get response for URL:, referer: http://localhost:8000/wp-admin/admin.php?page=wp-static-html-output
wordpress_1_72dc1c77882a | [Wed Nov 28 15:47:56.549039 2018] [php7:notice] [pid 219] [client 172.23.0.1:47346] http://localhost:8000/wp-content/themes/twentyseventeen/rtl.css, referer: http://localhost:8000/wp-admin/admin.php?page=wp-static-html-output
wordpress_1_72dc1c77882a | [Wed Nov 28 15:47:56.549061 2018] [php7:notice] [pid 219] [client 172.23.0.1:47346] WP_Error Object\n(\n    [errors] => Array\n        (\n            [http_request_failed] => Array\n                (\n                    [0] => cURL error 7: Failed to connect to localhost port 8000: Connection refused\n                )\n\n        )\n\n    [error_data] => Array\n        (\n        )\n\n)\n, referer: http://localhost:8000/wp-admin/admin.php?page=wp-static-html-output
wordpress_1_72dc1c77882a | [Wed Nov 28 15:47:56.549799 2018] [php7:notice] [pid 219] [client 172.23.0.1:47346] error in wp_remote_get response for URL:, referer: http://localhost:8000/wp-admin/admin.php?page=wp-static-html-output
leonstafford commented 5 years ago

Hi @kykungz,

Sorry for the late reply.

The clue is in this cURL error 7: Failed to connect to localhost port 8000: Connection refused for the URL http://localhost:8000/wp-content/themes/twentyseventeen/rtl.css, probably the first URL it's attempting to crawl.

I used to use Docker primarily for developing this plugin and it was working well, but I can't recall exactly my setup.

It would appear that there is a discrepancy between what Docker sees as the WordPress and what the plugin and you see the URL as.

ie, you're accessing the site at localhost or localhost:8000?

The plugin runs within the Docker container, so it needs the WordPress URL to be what's accessible within the container, not necessarily what you use to access it from the host machine.

I'd fiddle around with that and adjusting the WP siteurl and home settings until it works.

Please let me know if still having issues and I can do some Docker testing.

Cheers,

Leon

leonstafford commented 5 years ago

Hi @kykungz,

I've just done some testing with your exact docker-compose.yml and put a little guide here, for the settings to be used with the latest build of the plugin (available at the Release page in GitHub):

https://forum.wp2static.com/-44/how-to-use-with-a-docker-compose-setup

You may still have some issues with your host name resolution. If that's the case, please post on the forum: https://forum.wp2static.com and I'll help you diagnose and work through it.

Cheers,

Leon