Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Internal server error during backup?

Started by Muut Archive 10 years ago · 15 replies · 605 views
10 years ago

I have spent hours adjusting file permissions which only stopped things working.
I have only one error message to deal with now, that is when I do a backup,
I get "internal server error" in a red popup, yet when I look there is a backup zipped file in the backup folder.
I have all permissions 0777 for testing, so there should be no possibility that file permissions are the problem.
Can anyone help with this error.

Thanks, john

10 years ago

Just to add to my original post, the small icon keeps spinning even after I get the internal server error popup, and before this error first appeared, during my first tiral backup, I got a message that had something something close() in a red popup,
putting the spinning icon and this message together tells me a script is still running even after it has completed its task, is there a chance this is a coding error in GRAV.

10 years ago

Hi, am using Hiawatha Web Server. l access the site as a sub domain, this should have nothing to do with it. I use php-fpm, and have FluxBB and had bookings script also php based all working without error on same server with hiawatha and apache.
Php and hiawatha are clearly communicating, I will point apache at GRAV later to see what happens. I like what I see in Grav, but way too many file permission problems, I should be structured so that folders and files are kept in groups which represent their permissions, no point in sticking one file that needs 0777 in with others that are all 0644 for example, this in my opinion is the biggest problem am facing.
Also, it is not made clear until after install that one can select via GRAV
to use one of four caching scripts, and as such I have memcached (NOT MEMCACHE) installed instead of one of the options available in GRAVE, which I presume are known to work with GRAV.

Regards, john

10 years ago

@john what about the symlinks? Are you using those?

10 years ago

Here is an example hiawatha config file, I have GRAV set up like the sub domain entry in the below.
I tried pointing apache to my GRAV install folder, I can access the single default home page, but can not get the admin section to open, is there a specific way to get to the admin login screen, all of this worked in hiawatha, other than the one error am left with and the file permission issues.
I do not understand sym links, and am not to my knowledge
using them.
EXAMPLE HIAWATHA CONFIGURATION FILE BELOW

FIRST!!!!!

MAKE A COPy OF hiawatha.conf file BEFORE YOU MAKE

ANY ALTERATIONS, better to be safe than sorry.

Note, am using php Fast-CGI

THEN

Use the below tookit in your hiawatha.conf file

Use either the DEFAULT WEBSITE section to enter your

details, or a virtual host section

DO NOT USE BOTH

There are many other settings in the hiawatha.conf

file that are not shown here, just copy and paste the

parts in this file into your hiawatha.conf file and

alter where need be,such as "yourfolder" which should

be replaced by the name of the folder you install GRAV into,

when you open "yourfolder" you should see al the GRAV folders

and files inside.

and "yoursite" should be replaced by the likes of "microsoft", as

if your site were named microsoft.com

===Toolkit Below is for GRAV On hiawatha Web Server ===

UrlToolkit {
ToolkitID = grav

Match base64_encode[^(]([^)]) DenyAccess
Match (<|%3C)([^s]s)+cript.(>|%3E) DenyAccess
Match GLOBALS(=|[|\%[0-9A-Z]{0,2}) DenyAccess
Match _REQUEST(=|[|\%[0-9A-Z]{0,2}) DenyAccess

Match ^/(.git|cache|bin|logs|backup|webserver-configs)/(.) DenyAccess
Match ^/(system|vendor)/(.
).(txt|xml|md|html|yaml|php|pl|py|cgi|twig|sh|ba t)$ DenyAccess
Match ^/(user)/(.*).(txt|md|yaml|php|pl|py|cgi|twig|sh|bat)$ DenyAccess
Match .md$ DenyAccess
Match ^/(LICENSE.txt|composer.lock|composer.json|.htaccess)$ DenyAccess

RequestURI exists Return
Match .* Rewrite /index.php
}

=== End of This toolkit entry ===

Refference the GRAV toolkit above in the host or virtual host section

where you wish to include your GRAV sited details,like bolow.

DEFAULT WEBSITE, add your site details here, sub domains go

in a different section.

It is wise to use your IP address as the hostname of the default website

and give it a blank webpage. By doing so, automated webscanners won't find

your possible vulnerable website.

Hostname = 120.245.82.190

Hostname = 127.0.0.1

WebsiteRoot = /var/www/yourfolder
UseToolkit = grav
StartFile = index.php

ExecuteCGI = yes , no, you can see am using fastCGI

and the line below reflects this

UseFastCGI = PHP5

AccessLogfile = /var/log/hiawatha/access.log
ErrorLogfile = /var/log/hiawatha/error.log

This is the end of the default website section,

in reality there are many more options that one could include,

they are explained on the hiawatha website.

Below is an example of GRAV install details for subdomain.

Refference the GRAV toolkit above in the virtual host section

where you wish to include your GRAV site details,like shown beolow.

In the example below I am using a subdomain to access the Grav site.

If you wish to install GRAV as your main site, then use the default

site section and fill in your details there, they will be the same details

except you will not be entering any virtual host settings such as in the

example below.

BELOW IS A VIRTUAL HOST ENTRY.

Hostname = myblog.example, *.myblog.example

VirtualHost {
Hostname = www.yourfolder.yoursite.com, *.yourfolder.yoursite.com
WebsiteRoot = /var/www/yourfolder
StartFile = index.php
AccessLogfile = /var/www/yourfolder/access.log
ErrorLogfile = /var/www/yourfolder/error.log

TimeForCGI = 10

ExecuteCGI = yes

TXT
UseFastCGI = PHP5
UseToolkit = grav

UseToolkit = banshee

}

The below settings shoud be at the top of this file, IP

put them here as they are just for clarification if need be.

They show the http settings and how to include a script functionallity.

GENERAL SETTINGS

#

ServerId = www-data

ConnectionsTotal = 1000
ConnectionsPerIP = 25
SystemLogfile = /var/log/hiawatha/system.log
GarbageLogfile = /var/log/hiawatha/garbage.log

BINDING SETTINGS

A binding is where a client can connect to.

#
Binding {
Port = 80
}
#

Binding {

Port = 443

TLScertFile = ssl/hiawatha.pem

Interface = 127.0.0.1

MaxRequestSize = 2048

TimeForRequest = 30

#

}

BANNING SETTINGS

Deny service to clients who misbehave.

#

BanOnGarbage = 300

BanOnMaxPerIP = 60

BanOnMaxReqSize = 300

KickOnBan = yes

RebanDuringBan = yes

COMMON GATEWAY INTERFACE (CGI) SETTINGS

These settings can be used to run CGI applications.

#

CGIhandler = /usr/bin/perl:pl

Uncommented the line below after initial install.

CGIhandler = /usr/bin/php-cgi:php

CGIhandler = /usr/bin/python:py

CGIhandler = /usr/bin/ruby:rb

CGIhandler = /usr/bin/ssi-cgi:shtml

CGIextension = cgi

#
#
FastCGIserver {

FastCGIid = PHP5

ConnectTo = /var/lib/hiawatha/php-fcgi.sock:9000, does not work,

ConnectTo = /run/php-fpm/php-fpm.sock does not work,

ConnectTo = 127.0.0.1:9000

port 9000 is configured in the php-fpm conf file

Extension = php
}

10 years ago

Any chance to get that config file in a code snippet? i.e. between triple dashes? --- to convert it into markdown-style code block ?&quest;?

10 years ago

I hope this is what you have asked for, this is the same example hiawatha.conf form I posted above, I can not post my own as its from a live server and shows too much, but I have GRAV installed as a sub domain, along with many other php installations, that all work, there is an entry in my DNS server to open the correct site, so hiawatha has no way of messing this up.

--- #FIRST!!!!!

MAKE A COPy OF hiawatha.conf file BEFORE YOU MAKE

ANY ALTERATIONS, better to be safe than sorry.

Note, am using php Fast-CGI

THEN

Use the below tookit in your hiawatha.conf file

Use either the DEFAULT WEBSITE section to enter your

details, or a virtual host section

DO NOT USE BOTH

There are many other settings in the hiawatha.conf

file that are not shown here, just copy and paste the

parts in this file into your hiawatha.conf file and

alter where need be,such as "yourfolder" which should

be replaced by the name of the folder you install GRAV into,

when you open "yourfolder" you should see al the GRAV folders

and files inside.

and "site" should be replaced by the likes of " microsoft", as

if your site were named microsoft.com

===Toolkit Below is for GRAV On hiawatha Web Server ===

UrlToolkit {
ToolkitID = grav

Match base64_encode[^(]([^)]) DenyAccess
Match (<|%3C)([^s]s)+cript.(>|%3E) DenyAccess
Match GLOBALS(=|[|\%[0-9A-Z]{0,2}) DenyAccess
Match _REQUEST(=|[|\%[0-9A-Z]{0,2}) DenyAccess

Match ^/(.git|cache|bin|logs|backup|webserver-configs)/(.) DenyAccess
Match ^/(system|vendor)/(.
).(txt|xml|md|html|yaml|php|pl|py|cgi|twig|sh|ba t)$ DenyAccess
Match ^/(user)/(.*).(txt|md|yaml|php|pl|py|cgi|twig|sh|bat)$ DenyAccess
Match .md$ DenyAccess
Match ^/(LICENSE.txt|composer.lock|composer.json|.htaccess)$ DenyAccess

RequestURI exists Return
Match .* Rewrite /index.php
}

=== End of This toolkit entry ===

Refference the GRAV toolkit above in the host or virtual host section

where you wish to include your GRAV sited details,like bolow.

DEFAULT WEBSITE, add your site details here, sub domains go

in a different section.

It is wise to use your IP address as the hostname of the default website

and give it a blank webpage. By doing so, automated webscanners won't find

your possible vulnerable website.

Hostname = 120.245.82.190

Hostname = 127.0.0.1

WebsiteRoot = /var/www/grav
UseToolkit = grav
StartFile = index.php

ExecuteCGI = yes , no, you can see am using fastCGI

and the line below reflects this

UseFastCGI = PHP5

AccessLogfile = /var/log/hiawatha/access.log
ErrorLogfile = /var/log/hiawatha/error.log

This is the end of the default website section,

in reality there are many more options that one could include,

they are explained on the hiawatha website.

Below is an example of GRAV install details for subdomain.

Refference the GRAV toolkit above in the virtual host section

where you wish to include your GRAV site details,like shown beolow.

In the example below I am using a subdomain to access the Grav site.

If you wish to install GRAV as your main site, then use the default

site section and fill in your details there, they will be the same details

except you will not be entering any virtual host settings such as in the

example below.

BELOW IS A VIRTUAL HOST ENTRY.

Hostname = myblog.example, *.myblog.example

VirtualHost {
Hostname = www.grav.site.com, *.grav.site.com
WebsiteRoot = /var/www/grav
StartFile = index.php
AccessLogfile = /var/www/grav/access.log
ErrorLogfile = /var/www/grav/error.log

TimeForCGI = 10

ExecuteCGI = yes

TXT
UseFastCGI = PHP5
UseToolkit = grav

UseToolkit = banshee

}

The below settings shoud be at the top of this file, IP

put them here as they are just for clarification if need be.

They show the http settings and how to include a script functionallity.

GENERAL SETTINGS

#

ServerId = www-data

ConnectionsTotal = 1000
ConnectionsPerIP = 25
SystemLogfile = /var/log/hiawatha/system.log
GarbageLogfile = /var/log/hiawatha/garbage.log

BINDING SETTINGS

A binding is where a client can connect to.

#
Binding {
Port = 80
}
#

Binding {

Port = 443

TLScertFile = ssl/hiawatha.pem

Interface = 127.0.0.1

MaxRequestSize = 2048

TimeForRequest = 30

#

}

BANNING SETTINGS

Deny service to clients who misbehave.

#

BanOnGarbage = 300

BanOnMaxPerIP = 60

BanOnMaxReqSize = 300

KickOnBan = yes

RebanDuringBan = yes

COMMON GATEWAY INTERFACE (CGI) SETTINGS

These settings can be used to run CGI applications.

#

CGIhandler = /usr/bin/perl:pl

Uncommented the line below after initial install.

CGIhandler = /usr/bin/php-cgi:php

CGIhandler = /usr/bin/python:py

CGIhandler = /usr/bin/ruby:rb

CGIhandler = /usr/bin/ssi-cgi:shtml

CGIextension = cgi

#
#
FastCGIserver {

FastCGIid = PHP5

ConnectTo = /var/lib/hiawatha/php-fcgi.sock:9000, does not work,

ConnectTo = /run/php-fpm/php-fpm.sock does not work,

ConnectTo = 127.0.0.1:9000

port 9000 is configured in the php-fpm conf file

Extension = php
} ---

10 years ago

Hi rhukster, why ask for this code and then not comment

10 years ago

I'm actually on a family vacation now. Was trying to squeeze it in before I left, but ran out of time :(

Maybe someone else can pick this up while i'm away?

10 years ago

Ah, now I understand, hope someone gets involved, as I do not think this particular error is related to file permissions, and php is working with other web applications without any errors.

10 years ago

After I figured out how to get Hiawatha to run, I tried and I have no issues in Admin doing backups.

I cannot replicate the problem, so I'm not sure what to suggest.

Is there a reason you want to use that over Apache/Nginx/Caddy which are more widely known and used?

10 years ago

Hi, I use hiawatha because it uses very few resources, if you type, free -m in a command shell and run one server at a time you will see the one that uses the least memory.
I just wonder if we are using the same version of GRAV and php, perhaps that could have something to do with it, I use fastCGI via a tcp connection. I tried apache and cant get to the admin page, just to the default home page, any idea why I get an error "not found" when I type the path to the admin page.

10 years ago

Thanks Flaviocopes, I have the .htaccess file in the GRAV folder, so that should be ok.

10 years ago

Ok, I manually edited my httpd.conf file, and the admin section is opening, I did a backup, it took way longer than hiawatha, BUT, I got ready to download message, which leads me to believe php is not my problem, the only difference that stands out is the rewrite rules, one could assume apache is doing it correctly, and thats because GRAV devs wrote the .htaccess file, stuck now as to why hiawatha completes a backup throws an error that stops it from showing the success message I get with apache.
Any ideas, also, did flaviocopes install GRAV as I did as a subdomain, and should this matter, I am accessing GRAV via a domain and via hiawatha as a sub domain, don't know if this should matter, cant see it doing so.
as none of my other sites care.

Regards & thanks, john

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1368 9 years ago
Archive · by Muut Archive, 9 years ago
2 940 9 years ago
Archive · by Muut Archive, 9 years ago
2 4069 9 years ago
Archive · by Muut Archive, 9 years ago
1 2960 9 years ago
Archive · by Muut Archive, 9 years ago
3 1125 9 years ago