admin管理员组

文章数量:1398827

What I have: as title suggests I set up a WordPress installation on my local machine and can run it and visit it (Mac + MAMP) over localhost:8888/myBlog. It works fine. By sharing my IP I am able to reach the WordPress blog from another computer (myIP:8888/myBlog). But here is the problem.

The problem: the page loads, but not the .js, nor the .css. By inspecting the console I see six ERR_CONNECTION_REFUSED for js and css files coming from wp-content (.css and .js of a theme I installed) and from wp-includes (again .css and .js files).

What I tried: I thought it was a problem of permission so I changed the main folder and all the files recursively with chmod -R 575 as suggested somewhere but the problem persists.

Thanks!

What I have: as title suggests I set up a WordPress installation on my local machine and can run it and visit it (Mac + MAMP) over localhost:8888/myBlog. It works fine. By sharing my IP I am able to reach the WordPress blog from another computer (myIP:8888/myBlog). But here is the problem.

The problem: the page loads, but not the .js, nor the .css. By inspecting the console I see six ERR_CONNECTION_REFUSED for js and css files coming from wp-content (.css and .js of a theme I installed) and from wp-includes (again .css and .js files).

What I tried: I thought it was a problem of permission so I changed the main folder and all the files recursively with chmod -R 575 as suggested somewhere but the problem persists.

Thanks!

Share Improve this question edited Mar 23, 2020 at 11:53 Masiar asked Mar 23, 2020 at 11:39 MasiarMasiar 1134 bronze badges 4
  • What's the URL for the ERR_CONNECTION_REFUSED ? Is that still 'localhost', i.e. the other machines are trying to load the files from themselves not your server? Is the host, port and HTTP/HTTPS of those URLs correct? If they are, can you check the access and error logs of your web server? – Rup Commented Mar 23, 2020 at 11:52
  • Yes! It's still localhost!! I didn't realize that... how can I fix this? – Masiar Commented Mar 23, 2020 at 11:54
  • That's the 'WordPress address' and 'Site address' in Settings, General. You should set these to the URL your clients should be using, i.e. probably http://myIP:8888/myBlog – Rup Commented Mar 23, 2020 at 11:56
  • That was it! Thank you so much! If you answer I can upvote & set as correct answer! – Masiar Commented Mar 23, 2020 at 11:58
Add a comment  | 

1 Answer 1

Reset to default 1

As discussed in comments, the problem was that the site address was set to localhost:8888/myBlog. This is the URL WordPress is expecting your clients to be using, and uses this to generate fully-qualified URLs for scripts and CSS etc. Hence your other clients were trying to load scripts and CSS from their own localhost.

The fix is to set the correct URL, http://myIP:8888/myBlog, as the 'WordPress Address' and 'Site Address' under Settings, General.

本文标签: