Closed timotheegoguely closed 4 years ago
Hi @timotheegoguely, thanks for using the plugin. Your issue should be solved by changing base_url
to /static/
. Then you can access the static site under the /static
uri.
If this does not work, feel free to reopen the issue. :)
Thank you for your answer. I edited the base_url
as you suggested and I can access to the static version of my website via the /static
uri as expected, but my problem is how can I configure my website so the root folder is /static
, but without seeing it in the url (mywebsite.com, not mywebsite.com/static), and being still able to access to the back-office via mywebsite.com/panel
.
As mentioned on the forum, the RewriteBase /static
in the .htaccess
file doesn't solve my problem because it brokes the /panel
access.
Hi @timotheegoguely - ok, in that case, /
is the correct base url and you need to set up your server in a way that it serves everything from /static
except for the panel urls. If .htaccess
has any effect for you, you are probably using apache or some setup that uses apache as a server. I'm usually using nginx or just kick off a local php server, so my apache knowledge is rather rusty. However, I think what you'll want to do is specify a different DocumentRoot
for the /panel
directory in your VirtualHost
config. If somebody else with more apache knowledge could jump in here, that'd be great. In any case, your issue is not directly related to the plugin. As long as you use /
as base url, and set up your server so that it serves everything except for /panel
from the /static
subfolder, it should work.
It seems, in apache it works a bit differently, you'll need to use mod_rewrite for the panel urls and set your DocumentRoot for all the other pages to the static folder.
Ok thank you very much for your advices. Let's try to configure this Apache server!
@jonathan-reisdorf @timotheegoguely Would you mind to share your nginx/apache configuration and add it to the READEME.md as documentation?
Hi @Manuel-Steinberg, while I see how that could be helpful, the plugin focuses on creating a static file structure that is compatible out of the box with most if not all CDNs. An nginx host configuration should be extremely simple, something like
server {
listen 80;
listen [::]:80;
server_name localhost;
index index.html;
root /path/to/your/static/site;
}
(of course, adapt port
, server_name
etc. to your needs)
So, you will not even need location directives or similiar. Just specifying ìndex
and root
is all that nginx needs (will be similiar with Apache).
Or are you talking about a setup where Kirby as well as the static site are both served via nginx? In that case, you would merge the typical kirby nginx config together with a location directive which changes the root and index. But I would not advise to run Kirby and the static page both under the same nginx host, as that counterfeits the purpose of the plugin. Of course I could imagine a scenario where you have a single machine (e.g. bare server) which would run Kirby under a basic auth protected path and the static site is mounted under /
. Let me know if that's what you're after. In general, it's easier and more clean to have two separate nginx hosts, though, one running the static site, one running kirby. The kirby host could be a subdomain.
Hey @jonathan-reisdorf, thanks for the reply and the advise regarding the separation! I think I will try this one. 👍
Indeed I was up for the second scenario, like having the following file structure:
project/
┣ assets/
┣ content/
┣ kirby/
┣ media/
┣ site/
┗ static/
The idea was to deliver the static files on default, but heading to /panel/
will serve the Kirby panel (so clients can do changes and the final result will be static). So everything at the same place under the same host seemed to be more easy to manage - wrong thought...
Hi, I love your plugin, but I have some issues about how to configure it.
I just posted this topic on Kirby forum describing my problem: https://forum.getkirby.com/t/static-website-configuration/17496
Any idea on how to solve it?
I'm using the the v1.0.8 of your plugin with Kirby v3.3.3, PHP 7.4 and macOS Catalina 10.15.3