@NeptuneUK hereās what I get when I run apachectl configtest: Syntax OK
and hereās the contents of /etc/apache2/sites-available/nextcloud.conf:
Alias /nextcloud "/var/www/html/nextcloud/"
<Directory /var/www/html/nextcloud/>
Options +FollowSymlinks
AllowOverride All
<IfModule mod_dav.c>
Dav off
</IfModule>
SetEnv HOME /var/www/html/nextcloud
SetEnv HTTP_HOME /var/www/html/nextcloud
</Directory>
@victorbw Iāve tried your two suggestions, both with no change. (Still getting Internal Server Error.)
apache2: nextcloud.conf is listed above, and hereās Nextcloudās config.php:
I tried that, restarted Apache, and Nextcloud did allow me to sign in. Then, clicking on Admin/Services it crashed back to displaying āInternal Server Errorā.
So I removed your code and restarted Apache again. Still āInternal Server Errorā. As a last resort, I stopped and started both MySQL and Apache and found I could access the site ā for a while.
Nextcloud now stays up sometimes for minutes at a time, then ā while in the middle of simple housekeeping tasks such as adding an email address for admin ā it simply crashes out to the login screen. And wonāt let me log in again. Nothingās changed. Thereās only one user and one password, but it insists theyāre wrong. The only way to get back in is to restart MySQL and Apache, then I can log in again.
Just tried it again. Clicked on Admin/Apps. Bang! Out again to the login screen but no login accepted. Stop and start MySQL and Apache and I can get back in again ā¦ for a few more minutes.
There are no significant issues on the Overview ā just a warning about using HTTP ā and the NC Security Scan gives the site an A rating.
You shouldnāt try to change more than one thing at a time, when performing such kind of trouble shooting. First, Iād rule out the MySQL instanceā¦ no need to restart it, if itās working. So before you restarted MySQL did you check to see, if it still runs and if you can connect to it using the credentials you have in your config.php?
Thanks for the feedback on your nextcloud.conf and the apache syntax check.
They both seem fine in terms of configuration at the site level.
1.) Could you post the contents of your /etc/httpd/conf/httpd.conf?
2.) Was this install a fresh one, on a clean box? That is to say this box wasnāt in service prior to to your attempt to install NC?
3.) Does the server meet the recommended minimum installation requirements?
I noticed you deviated from the NC install guide you referenced.
As I installed on a virgin lightsail instance, using the same NC installation guide, OS (and version) and NC version, it would seem at this point to indicate that Ubuntu isnāt the issue, or NC. It would point to a configuration issue with Apache. Sometimes a small omission or typo can have bewildering effect.
It also seems that the original issue you posted is resolved. That is to say .php files are not being served as text/raw files. Correct us if this is not the case. It would seem you are now dealing with other issues. @budy gave some great advice, stick to the issue at hand, one at a time, implement a suggestion, test, evaluate, feedback and if not resolved move forward, just small steps one at a time.
My personal opinion at this point would be to do a completely fresh install from scratch on a clean box if this is possible. Follow exactly the guide you referenced, donāt change anything. Establish if the install and initial configuration is good. Then small steps to change data directory etc. Obviously remembering to backup your server at key points to enable you to roll-back if needed.
Thanks for the response. In response to your pointsā¦
Iām guessing you mean /etc/apache2/apache2.conf. (Thereās no /etc/httpd/conf/httpd.conf in Ubuntu.) Itās a 7K file so rather than post it here, Iāve copied it to a Pastebin link: https://pastebin.com/yxEhWSLF
Yes, this was a fresh install.
Yes, the server meets the minimum requirements.
And yes, the original issue has been resolved, and thatās lead on to the current issue.
Iāve been developing and testing software for decades so Iām well aware of the incremental nature of the debugging process, and that is partly why Iām hesitant to do a fresh reinstall. NC is now working, sometimes for 10-15 minutes at a time. Then it simply crashes out to the login screen and refuses a login until I restart Apache. That suggests a problem in NC itself. (Or perhaps not. Having just typed the above, I had a crash out to an āInternal Server Errorā screen which requires a restart of MySQL and Apache, then Iām back to login.)
You say you tried a virgin install on Lightsail. Did you also run it for a while? Iām back in again just now, looking at Logging, Apps, etc. then, after a few minutes, it crashes back to āInternal Server Errorā.
Iām not sure what you mean when you say I deviated from the installation guide. The only deviation Iām aware of was to reference attached storage when configuring Nextcloud. The reason I did that was because I followed the advice detailed here, specifically:
Changing data directory after installation is not officially supported. Consider re-installing Nextcloud with new data directoryā¦
(The original was also in bold type!)
Wiping the server and starting again is an option, but that will destroy any chance of learning whatās actually going wrong here ā and perhaps finding a rare, gnarly bug that could affect someone else.
So maybe it might be best to document which action you implemented that led to the original issue āNextcloud Nightmare - php code is shown instead of web interfaceā being resolved, then marking this thread as closed and resolved, attributing whoever if anyone gave the solution that worked for you.
That done open a new thread with the new issue you are experiencing? It will make it easier for people to locate whichever issue it is they are experiencing and itās resolution.
I ran the instance I span up for about 3 days, and it had a few visits other than myself. The instance remained available and stable during that time without crashing, displaying PHP as text/raw and there were no other issues in the error or sys logs. I obviously then terminated the instance as itās billable.
Yes the deviation for the data directory is specifically what I was referring to. It wasnāt something you mentioned previously, and is important in terms of the operation of NC (NC checks the data directory and specifcally a text file written there). If NC is unable to read the text file for whatever reason (permissions, mountpoint availability etc) you can see the āinternal serverā error message, depending on what / how you mounted your data directory could have a bearing (eg a physical disc that is slow to respond to read requests after idling.) Also the omission could indicate other deviations you felt werenāt relevant, but that possibly could be.
1.) What do the apache / NC logs have to say about the āinternal server errorā?
2.) What happens if you change the data directory to the default location (same physical media as you NC installation?) Do you get stability.
3.) Do a fresh install, following the guide you referenced EXACTLY and see if the issue/issues are replicated again. This could point to a issue with your data directory mountpoint / media etc depending on the result. (You can always backup your current installation using your preferred method dd, rsync, tar etc) and restore later to troubleshoot if you really want to find that gnarly bug.
I just thought Iād mention I also just did a quick install on an MS Azure compute unit (alternative Hypervizor to AWS), using the guide you referenced. All worked OK and as expected.
I succumbed. Dumped the AWS Lightsail image and started a fresh one. Again, I followed the installation guide I referenced in my first post ā but without the extra storage, just a standard default install ā kicked it off, signed in, dismissed the intro, clicked on Admin and bang: Internal Server Error.
Since then itās continued to die at irregular intervals exactly as Iāve described above. Each time it requires a stop and start of MySQL and Apache. A typical example occurred just now deleting a folder. A popup appeared on the right saying āError deleting folder ā¦ā and the session dropped back to the login screen. But I canāt log back in even after clearing the browser cache, etc. āWrong username or password.ā Restart MySQL and Apache and I can log back in.
I can only conclude that itās a server issue. AWS Lightsail running Ubuntu 18.04 canāt handle Nextcloud. Iāll free up a local server and see if I have any more luck. Thanks for all your feedback and suggestions!
Once again I just followed the guide to which you reference in your original post (just user and password changes).
Itās up and running here: NO LONGER DEPLOYED.
Itās Ubuntu 18.04, latest NC on a Lightsail $5 instance in London. All running fine (except it is topping out the RAM, obviously, bbut for a proof of installation box thatās all Iām prepared to spendā¦ ) Took all of 5 minutes.
Added a NC test user with a miserly 500MB allowance, all OK. Been up for 30 mins no issues. Iāll leave it up overnight and see what happens, but all looks good as it did before.
Iāve used the referenced guide, Ubuntu 18.04, NC, Lightsail $5 London UK region. This is the second time Iāve done this now and both times without issues. The only variable in this is you and I.
So just deleted the Lightsail instance I span up, itās run for 2 days without any issues.
I can only conclude the following:
AWS Lightsail (London Region) + Nextcloud + Ubuntu 18.04 + Referenced Guide = Good Installation and Configuration Candidate.
As my previous post, if you can advise which Lightsail Region and zone you are using and experiencing problems in, Iāll try to duplicate. If that works OK, maybe you could consider creating an IAM for a Lightsail instance user and Iāll create an instance in your AWS LS account and see what happens then.
As the OP seems to be on AWS, do you have instructions for an installation path on the AWS hypervisor stack?
Has this VM been tested on the AWS HVM Stack? Any feedback?