Nextcloud with a PHP server

Is it possible to have a Nextcloud instance running at the same time as an Apache instance? I want to upload a .php or .html file from my PC to Nextcloud, then go on my phone and open the uploaded file to see what the website looks like on my phone.

Nextcloud uses php and the apache instance to serve itself.

That’s not possible. Nextcloud is not a webserver. You could open a php or html file in the web GUI of your Nextcloud instance with the integratetd text editor and look at the code. But Nextcloud canot serve it like a webserver would do. But there are various FTP/SFTP clients for Android and iOS, wich can upload the files to a server where apache and php is running on.

If you want to do this on the same server where your Nextcloud is running, this is also possible… Keyword: Virtualhosts. But you should be careful that everything is configured securely and you don’t open any backdoors. Personally I would not run such tests on my productive nextcloud server, where all my private data is stored.

Hope that helps.

1 Like

it might be possible if you use 2 domains and no encryption.
1 for nextcloud and 1 another one for the website pointing into the data subfolder where you upload files. so basicly you still use nc only to upload files but use the other domain to view the website.

1 Like

And why should you bother using Nextcloud just to be able to upload a few HTML and PHP files and serve them via Apache in a “hacky” way, if you can simply upload them via SFTP client directly to their proper location? Makes no sense to me and sounds a lot more complicated…

1 Like

the question was if it’s possible not what’s your opinion.

1 Like

Actually, it seems to be possible. Since Nextcloud is hosted on my local network (raspberrypi) I don’t have to worry much about other people downloading my files.
That being said, I can just go to<username>/files/<pathToFile> and it will open it.


and it works on php and HTML files, too.

1 Like

Just a little note, also for others, who read this and may find this a good idea: :wink:

If it works like this, that means two things:

  1. The web server is configured insecurely.

  2. The data directory is located within the Apache webroot, which is not recommended for security reasons.

I guess it’s ok as long as you only use it in the local network and only for test purposes. But I would strongly advise against making it accessible from the Internet this way. Especially if you have stored private files on this Nextcloud instance.

That beeing said. Have fun. :slight_smile:

yes, that’s true. but it’s ok since it’s on my local network i guess.

thanks for your help!