Setting sabre/dav to have root directory outside of apache web root - apache

I am trying to set up a WebDav server using sabre/dav. I got it set up and running and as long as I serve up files form with in the web server root (like /var/www/mydocs) I can access them in read-write mode. However, when I move sabre’s root directory to be like /mnt/mydocs I can only access them in read only mode. I do not think it is file permissions because I set them up the same both places and gave apache full access to both. I think it might be apache directory access directives but I have not found any combination that works. The last thing I tried in the apache config file was something like this.
<Directory “/mnt/mydocs”>
Options +FollowSymlinks
AllowOverride All
Require all granted
</Directory>
Any ideas? Thanks for your help.

Related

access same directory from multiple domains

Hi I have several domains that would like to access the same image repository. Is there an easy way of doing this? I am running plesk on linux.
I have found this page https://httpd.apache.org/docs/2.4/mod/core.html#directory. with this syntax to be put in the additional directives for http and https sections in the server settings.
will this
<Directory "/usr/local/httpd/htdocs">
Options Indexes FollowSymLinks
</Directory>
allow me to read and write to those directories?
FollowSymLinks option will allow exactly it - Apache will be able to process data which is not physically located inside domain directory, but is referred to by a symlink located inside domain directory.
There are two major points that you should be aware of:
1. You should have sufficient permission for system users of the domain which will be accessing shared files on the directory which contain these files. Basically, chmod 666 will do the job, but it is up to you how exactly set up rights to maintain desirable security level.
2. If websites are using PHP code, you should ensure that shared directory is included in open_basedir value.
This link can be useful - How to change open_basedir parameter for all domains?

Using EBS for the www/http directory

I have a simple web server set up on an ec2 instance.
I want to use a separate EBS disk to store the websites it hosts.
I have created and mounted a disk at /data and can access it via SSH and ftp.
But when i try to serve websites from it by specifying a folder there in vhosts, I get the standard apache page.
I think it might be something to do with permissions / ownership of the directory but I can't seem to figure it out.
Any advice?
Simple solution: you need to add the folder you want to serve from (in my case /data) in /etc/httpd/conf/httpd.conf
<Directory "/data">
AllowOverride None
# Allow open access:
Require all granted
</Directory>

Deny direct access to folder from URL

So I have tried to follow some of the posts here to deny access to a public folder using .htaccess.
The problem is that I still can access the folder.
I have put the .htaccess inside my folder, with the commands?
Order allow,deny
Deny from all
I am missing something, but don`t know what.
BTW, I have restarted apache after that.
The site:
www.mysite.com
Folder I want to block
www.mysite.com/helloworld/
That configuration does exactly what you say it should do when I test it.
Presumably your server is configured not to respect .htaccess files.
You can change that by setting:
AllowOverride AuthConfig
… in your main configuration file.
See also the documentation for AllowOverride.
That said, if you don't want the content of a directory to be accessible to anyone over HTTP, then you are better off keeping that directory outside the web root in the first place.

Load images outside apache directory

Well, I have a website in apache directory: /var/www/html. Previously I had all my web images in /var/www/html/media, so I used to put /media/imgX.jpgfor loading them. but now I need to put them in /mnt/imgs.
For some reason, using this path does not work the same way as before.
I think it has something to do with permissions using files from outside apache directory but I am not sure about it. Any idea?
The easiest way to add directories to Apache httpd is to use the "alias" module:
Alias /images "/mnt/imgs"
<Directory "/mnt/imgs>
Options Indexes
AllowOverride All
Require all granted
</Directory>
Once you have set up this, test it with: "yourdomain.com/images".
Of course:
The directory "/mnt/imgs" need the appropriate rights, so Apache Httpd can access it. Therefore you need to find out the group it runs with.
These files will be available to the public, if you dont secure them.
Once this is functional, remove the "indexes" line from the snippet above.

Folders redirection in apache

I have user files stored in a folder outside apache's documents root e.g. My project is in /var/www/ProjectName/ and the files are in local drive(D:\users).
I want to be able to link to those files from within my project. i am using symfony(php framework).
I trying to change the setting in apache like this, But no luck
Alias /users/ "D:\users"
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
You have to update that in your httpd.conf or in your specified {name of your vhost}.conf.
Alias /users/ D:\users
Be sure to check the error log to see where here Apache tries to find the files.