Owncloud not available after installation on Ubuntu server 14.04 - php

With the goal to install owncloud (version 6.0.3-0) on my ubuntu server (14.04), I followed this guideline:
http://doc.owncloud.org/server/6.0/admin_manual/installation/installation_source.html
After having this completed, the /var/www/owncloud folder exists with the following content:
3rdparty core index.html occ robots.txt themes apps cron.php index.php ocs search version.php config data l10n public.php settings console.php db_structure.xml lib remote.php status.php
Visiting
http://localhost
results in a site like this: https://assets.digitalocean.com/articles/lamp_1404/default_apache.png indicating, that the apache-server works.
Visiting
http://localhost/owncloud
leads to server error 404: "Not Found".
Meanwhile, I tried the installation (owncloud 6.0.3-0) on my laptop (Ubuntu 13.10) to compare results. Skipping the above guidelines, just installing owncloud using the package-manager works out of the box, while the content of /var/www/owncloud results only in config data
Since it works on my laptop, I have the suspect, that I screwed up some configuration on my ubuntu server. Even so, reinstalling apache2 (including purge) did not help.
Do you have any ideas, where to start over?

This is because Apache 2.4's default web root is /var/www/html as opposed to /var/www. ownCloud's default installation ends up in /var/www/owncloud, which is outside of the web root.
I first solved this by creating a symbolic link at /var/www/html/owncloud, but I found it cleaner to simply change Apache's document root to /var/www/owncloud. If you want to preserve the owncloud subdirectory, you can point it to /var/www and get rid of /var/www/html and its contents.
Edit /etc/apache2/sites-enabled/000-default.conf (and/or the appropriate configuration for the SSL site in the same location, depending on your setup) to point DocumentRoot to /var/www or /var/www/owncloud, whichever works for you.
I just figured this out myself, so it may warrant further configuration changes. I will update this post if/when I figure out more tweaks need to be made, but it seems to be working for me, anyway.
Also this has nothing to do with programming and really belongs on superuser.com or perhaps serverfault.com.

This would be more appropriate as a comment as I'm completely clueless as to the solution, but the strange system of SO doesn't allow me to post comments. I have an idea that may not help but just want to confirm that it's not the problem.
Have you tried the following URL?
http://localhost/owncloud/index.html
The first thing that came to mind is that there is a problem with your Default Document settings.
If the above works, you can fix it so you don't have to define the HTML file in the URL by creating a .htaccess file in your server root directory with the contents being:
DirectoryIndex index.php index.html index.htm default.html default.htm home.html
Hope this helps.

Related

How to setup/access page in subdirectory of separate project for a Laravel/OctoberCMS website?

I have a website running an OctoberCMS theme that I built. It's running on a server from DigitalOcean. I need to add a separate project (namely code from Matomo analytics) on the same server and access a public page (e.g. my_site.com/matomo). I'm new enough to Laravel and server configurations that I'm unsure of how I need to configure the index.php files or maybe something like .htaccess so that I can access my_site.com/matomo.
Here's my file structure
/var/www/html/
index.php (serves the pages of my project)
artisan
bootstrap/
config/
modules/
plugins/
server.php
storage/
themes/
vendor/
matomo/ (for installing the analytics for the site)
index.php
matomo.php
piwik.php
config/
a number of other files I can enumerate if necessary
I've followed the instructions from matomo but to no avail. When I try to go to my_site.com/matomo I just get a 404 from my website with my theme's formatting for it.
I know this shouldn't be hard. Thanks!
EDIT: The home page of my website is at my_site.com, as desired. The various pages are at my_site.com/page_name. This is configured fine for my purposes.
Now, for Matomo, the instructions say:
Open your FTP client and upload the Matomo files in ‘binary mode’ to the desired location on your web server. For example using the Filezilla FTP client, you can enable Binary mode transfer in the top menu Transfer > Transfer type > Binary). All files can be uploaded to a “analytics” sub-directory in your public www folder, for example http://yourdomain.org/analytics/ or you could setup Matomo in its own subdomain and upload all the files at http://analytics.example.org/
If you have SSH access to your server, you can use it instead of FTP as it is much faster: run
wget https://builds.matomo.org/matomo.zip && unzip matomo.zip
So, I used the wget option to add it to what I believe is the "public www folder", /var/www/html. So the instructions lead me to believe I can go to my_site.com/analytics/ and then view the GUI webpage for further install and setup. However, this doesn't work as it takes to a 404 page that's setup for the rest of my site. I also don't know that I'd expect it to work as none of the files or folders in Matomo are named "analytics" -- I've also tried my_site.com/matomo for the record. So, this is to say, I don't know where the Matomo page is presented.
I don't have any experience with Matomo, but from the question I understood that you want to install two software X as CMS and Y as Matomo.
Your web server(I assume Apache is the web server) will serve all request to the following path: /var/www/html/index.php. Which belong to software X. Your request my_site.com/matomo will be served to software X, and because X doesn't expect this request it will output 404 Not Found error.
The first solution: which is the bad solution and harder solution is to edit /var/www/html/index.php and combine it with Y index.php if request have matomo in the URL.
The second solution: which is the optimal and better solution is to separate X and Y. It could be done in several ways:
You can combine all X files in a folder under /var/www/html/x, and all Y files in folder under /var/www/html/y. Then you can access x using the following URL my_site.com/x and y using my_site.com/y.
If the first way in not possbile because you need to have X as root URL like my_site.com. Then you can combine all Y file under the following folder /var/www/html/matomo. Then you need to create sub domain (virtual host for Y).
Create virtual host using Ubuntu and Apache:
sudo touch /etc/apache2/sites-available/matomo.my_site.com.conf
Then edit the file using your favorite text editor I will use nano
sudo nano /etc/apache2/sites-available/matomo.my_site.com.conf
and past the following code:
<VirtualHost *:80>
ServerAdmin admin#my_site.com
ServerName matomo.my_site.com
DocumentRoot /var/www/html/matomo/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Change my_site.com to your domain.
Then you need to enable the virtual host
sudo a2ensite /etc/apache2/sites-available/matomo.my_site.com.conf
Then restart apache to see the result.
sudo systemctl restart apache2
Your matomo will be under the following URL matomo.my_site.com
If you are not using Ubuntu or Apache, tell me what are you using to update my answer.
You don't need to fix anything in index.php. Analytics counters can be added to the layout (~/themes/mytheme/layout/mylayout.htm) of the page between the
<head>
...
</head>
or
<body>
...
</body>
according to the instructions of your meter
See https://github.com/octobercms/october/issues/1615. You need to add the folder you want to allow access to as an exclusion to the October CMS .htaccess, and then also disable the line that disables running any PHP file other than index.php.
So replace RewriteEngine On with
RewriteEngine On
# Allow access to Matomo
RewriteRule ^(matomo)($|/) - [L]
and then comment out RewriteCond %{REQUEST_FILENAME} \.php$ so it becomes # RewriteCond %{REQUEST_FILENAME} \.php$.

Apache 2 start Wordpress instead of standard file

how to startup to wordpress instead of standard apache 2 file
I'm a complete noob when it comes to webdevelopment. I decided to find out how it worked a bit.
I created an apache 2 server on my raspberry pi model 3b plus. I installed a mysql database, and installed wordpress under /var/www/html/wordpress. I did it all according to this tutorial online. Only gave my database a different name and so on.
The only thing missing in the tutorial is how to now let my ipadress point to wordpress instead of index.html. My plan is to host a very simple wordpress site on my raspberry pi. And let my domainname point to the ip of the raspberry through a portforward on my router. So I need to start wordpress on the raspberry instead of the standard apache 2 files. Just to clarify extra: when I enter the Rpi adress into my browser now, it directs me to the "it works!" index.html file from apache2. I want it to go to the wordpress site I created when I enter the Rpi's ip adress. So I can go to my DNS host and let the domain name I own point to the outside IP adress of my router with a port, which I then redirect to the pi. I.E. host my own little website for fun.
I looked for the answer on the internet but couldn't really find an answer that explained this. The whole server thing, and hosting your own websites is still a bit vaque to me. As I said, never worked with it before. Any help will be appriciated.
There's a small mistake in the tutorial you followed.
To get things to work so hitting http://203.0.113.114/ where 203.0.113.114 is your machine's local IP address, you must install WordPress in your web server's root directory. The tutorial suggests you install it so you can hit http://203.0.113.114/wordpress to get it. That's not what you want.
The tutorial says to do this.
cp -R wordpress /var/www/html/
Instead you want to do this.
cp -R wordpress/* /var/www/html
That puts WordPress's files in /var/www/html/, not /var/www/html/wordpress/. After you do this, you should be able to say ls -al /var/www/html and see a bunch of files, including among others index.php.
Once you've done that, do the permission-changing stuff in your tutorial again. Then use your web browser to hit
https://10.11.12.13/
and you should get WordPress's setup wizard on your browser. Here are WordPress's own instructions.
Here's the thing to keep in mind: apache exposes a subset of your machine's file system to web browsers. That subset is rooted at the directory /var/www/html/. And also, when you have php installed, apache interprets files like foobar.php not as text, but as php programs. It runs them instead of just sending them to the browser. It's worth your trouble to wrap your brain around these concepts; they're the heart of web server technology.
Again, use your own IP address in place of 203.0.113.114.
You can create virtual host and access site from subdomain for example.
create host file
/etc/apache2/sites-available/wordpress.com.conf
enter
<VirtualHost *:80>
DocumentRoot "/var/www/html/wordpress/"
ServerName wp.localhost
</VirtualHost>
Then enable host with command sudo a2ensite wordpress.com
Then you should be able to access wordpress on subdomain wp.localhost / wp.{yourserveraddress}
Solved
I found the answer with both of the answers from O.jones and Koxo.
I created a new .conf file in /etc/apache2/sites-available called something.com.conf (just to test).
entered this bit of code in there:
<VirtualHost *:80>
DocumentRoot "/var/www/html/wordpress/"
ServerName something.com
</VirtualHost>
After that I did a2dissite 000-default.conf to turn the "old" config off. This is the config that directs you to index.html. Then I did a2ensite something.com which enables the website on the apache server. After that I did: sudo service apache2 restart to restart the service and everything worked.
Thank you O.Jones and Koxo for the help!

Apache serving 2 websites to one domain with path

I am new to this and I searched everywhere for a server routing method to be able to store 2 sites at different paths to a single domain. Most help I found refers to using virtual host to multiple domains, subdomains, IP etc. So far non of them fits what I need.
So I have the latest stack of Apache2, PHP, MySQL, on Debian-8 with 2 functional sites (databases, users, ...all OK) installed on sub folders of /html:
crm_site under /var/www/html/crm (storing a php script for project tracking)
and
wp_site under /var/www/html/wordpress (storing a wordpress website).
I want to be able to access them using the only domain I own (say www.example.com) which I already have set up to reach my server.
I was hoping that I would only need to add the path to my domain (www.example.com/crm/index.php or www.example.com/wordpress/index.php) and they will be served, but no matter what I add after the domain, the browser leads to the same place, showing the directory list in html (that is crm, and wordpress).
Can anyone tell me how can this be done? Thank you.
it sounds like you have everything setup correctly with the exception of your starting Directory.
It may be best to reword your question. This seems to be your situation (speaking from your perspective):
have a website at http://machine.domain.com
I want to set /var/www/html as my default directory
I want to set index.php as my default document
Once you view your issue this way, it is greatly simplified. A search engine can help you at this point.
To further guide you, doing said search for "apache set default directory" on Google, for instance, has the answer in bold. ... change the root directory of Apache or move the project to /var/www/html
You've already done this, right? So 1. and 2. above are done. If not, look at the following (which assumes apache2 package on Ubuntu latest. i've tested this in a docker container):
file: /etc/apache2/apache2.conf
contents:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
Change the above /var/www/ to /var/www/html/
Next, the .php serving issue. This is controlled by the DirectoryIndex directive as referenced here. Looking at it's contents shows that index.php is enabled by default.
example:
root#b62dsa09327e:/# grep -rnw '/etc/apache2/' -e "DirectoryIndex"
/etc/apache2/mods-available/dir.conf:2: DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
This takes care of 3. And now we're all out of issues in your original question.
Note: you may have to chown the directory to whatever apache2 is running as in the event you dropped files in there as root. You'll also have to restart apache in order to have the changes above reflect in the service.

.htaccess file won't respond on localhost:63342 in PhpStorm

I'm using the IDE PhpStorm 7.1.4 and trying to make an .htaccess file to stop users from going into a specific directory.
My folder structure is like this:
I want to make it so that users can't go in the /app folder or any folders inside that folder. For this, I've figured out that I can use this piece of code inside .htaccess:
Options -Indexes
I'm using the PHP web server from PHPStorm itself (which goes to localhost:63342/projectname/folderinproject/etc/etc/).
Problems
When directing to the page to the /app folder, I get an 404 error,
saying the index file doesn't exist.
When I have made an index.php file inside the /app folder, and I am redirecting to the /app folder, it just loading up the index.php.
When doing this with just a normal HTML project and opening the index.html via my windows explorer, the same problem occurs
Question
How can I make it so that my project would actually respond on the .htaccess file and wont allow me or other users to go into the /app folder?
EDIT
I figured out that when I copy all my files from my project to the c:\xampp\htdocs\ folder and turn on my Apache server inside of XAMPP, the .htaccess file is working whenever I open it via my regular browser (without selecting index.php in PhpStorm and choosing Open in browser...).
Is there any way I can do this same thing in PhpStorm without moving all the files?
If you are using the default configured web server, you are actually using PHP's new web server feature, which doesn't listen to .htaccess files. Only Apache listens to .htaccess files.
If you are wanting to test this functionality, you can either setup a VM running Linux and test, or setup WAMP on your system and run from there.
EDIT 1
Ok, can you add a little more detail about the exact problem? When you access localhost/app/ it is displaying the index.php file, instead of the 404. Does the application work entirely through the index.php file? If so, is the index.php file in the app or public?
EDIT 2
Ok, here's what you need to do. Place an .htaccess file in the root of your app directory. Clear the contents of this .htaccess and place the line DENY from ALL. You can keep the .htaccess file in the root of the project.
EDIT 3
PHPStorm is going to use the PHP Engine's web server. If you add the XAMPP location as a deployment path, it's fairly quick to deploy to. You can even setup PHPStorm to automatically deploy files to the XAMPP location on save. Here's the walk-through on the JetBrains site JetBrains Config.
The .htaccess plugins are mainly for editing and formating, not for modifying PHP Engine's server environment.
Using mod_alias is even easier:
Redirect 301 /app /new_directory
But if you have rewrite rules in your htaccess file already, then you need to stick with using mod_rewrite:
RewriteRule ^app/(.*)$ /new_directory/$1 [L,R=301]

Koala-Framework Website doesn't show first page

I got a question about a special php framework called Koala-Framework.
I've set up an apache2 on my virtual ubuntu OS, added a virtual host reserved only for my first website with this cms, also added the hosts entry and followed the tutorial on http://www.koala-framework.org/about/cms/installation , but if I enter the local domain (in my case the configured kwf-cms-demo.localhost), I'm only redirected to see the folder-structure and not the downloaded demo-website...
Which DocumentRoot the virtual hosts needs to be redirecting? (Because I think this could be the root of this problem...)
PS:
/var/www/kwf-cms-demo$ php bootstrap.php setup returns:
Application seems to be set up already. (update file exists)
so, I think the setup has to be finished without any problem...
Seems Apache isn't starting up the bootstrap.php because the rewrite rules in .htaccess are not honored.
Enable mod_rewrite like that:
sudo a2enmod rewrite
Also see point 5 here:
http://www.koala-framework.org/about/server_requirements/ubuntu_example_configuration

Categories