I have two alias, one works and one not. I think the problem with the wrong one is that has spaces in the directory name because is the only difference.
This works:
Alias /test/ "c:/test/noteboardapp/"
<Directory "c:/test/noteboardapp/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
Allow from all
</Directory>
This doesn't work:
Alias /noteboard/ "c:/Documents\ and\ Settings/odedios/Mis\ documentos/Google\ Drive/Trabajo/www/noteboardapp/"
<Directory "c:/Documents\ and\ Settings/odedios/Mis\ documentos/Google\ Drive/Trabajo/www/noteboardapp/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
Allow from all
</Directory>
I have the error: "You don't have permission to access /noteboard/ on this server."
I've scaped the spaces with "\" If I don't do the server doesn't run.
What is wrong?
Thank you!
Oscar.
EDITED: I've found the solution here Use Google Drive Directory as Apache Virtual host
The problem was that I was using a google drive folder and I have to change the permissions to access to this folder:
Right click 'Google Drive' Folder -> Properties -> Security Tab -> Advanced -> Change Permissions... -> Check 'Include inheritable permissions from parent folder'.
With this code:
Alias /noteboard/ "c:/Documents\ and\ Settings/odedios/Mis\ documentos/Google\ Drive/Trabajo/www/noteboardapp/"
You're telling Apache to find this directory:
C:\Documents\ and\ Settings\odedios\Mis\ documentos\Google\ Drive\Trabajo\www\noteboardapp\
Just remove all those bogus backslash characters.
Edit: White space is not the only difference between your two settings. The second alias points to a user profile, which is likely to be protected so only user odedios can read it.
Related
I'm running httpd on fedora server 35 and want to use it to serve files on my local network. It works fine for files stored under the /var/www/html directory directly (e.g. /var/www/html/videos/video.mp4 can be accessed with http://IP/videos/video.mp4 on any local device).
I want to serve files stored in other locations in the file system. My plan was to create symbolic links to those locations. When I do that, I run into forbidden errors when trying to access the files (e.g. A video file /files/videos/video.mp4 linked with a sym link /var/www/html/videos-link -> /files/videos/ so that I would (theoretically) access it with http://IP/videos-link/video.mp4
I can navigate to http://IP/videos-link fine (an Index of DIRECTORY page, but no files are listed), but trying to access the file (http://IP/videos-link/video.mp4) gives me 403 forbidden.
My config (/etc/httpd/conf/httpd.conf) looks like this (it's a bit messy since I've been trying to fix this myself):
<Directory />
Options FollowSymLinks Indexes
AllowOverride All
Require all granted
</Directory>
...
<Directory "/var/www">
Options +FollowSymLinks +Indexes
AllowOverride All
Require all granted
</Directory>
...
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
...
<Directory "/files/videos">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
In attempts to make it work I've made sure the sym link and all the directories have the same owner and that their all 777 so ownership/read perms shouldn't be an issue. Would greatly appreciate some help, thanks.
My issue was with SELinux. To get it working immediately I was able to set SELinux to permissive mode with
# setenforce 0
That refreshes on boot and is probably insecure, so the permanent fix (to just let httpd through) would be:
# semanage permissive -a httpd_t
More details on SELinux in Fedora can be found here: https://docs.fedoraproject.org/en-US/quick-docs/getting-started-with-selinux/
I want to remove the file extension for some of my files using Alias in my Apache site config file, but i just can't get it to work.
Here is an example:
Alias "/alias" "/the/real/path"
I have also tried this:
Alias /alias /the/real/path
With both i have tried the full path and the relative path from the root directory.
Does any one know how to probaly use Alias to do this?
Be sure to set AllowOverride All in the Directory config.
Example:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
I just installed XAMPP on my personal CentOS box and when I try to disable Directory Listing I get an Apache error when restarting. My httpd.conf file looks like this after I make the changes:
httpd.conf
Alias /bitnami/ "/opt/lampp/apache2/htdocs/"
Alias /bitnami "/opt/lampp/apache2/htdocs"
<Directory "/opt/lampp/apache2/htdocs">
Options -Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Error
XAMPP: Starting Apache...fail.
AH00526: Syntax error on line 5 of /opt/lampp/apache2/conf/httpd.conf:
Either all Options must start with + or -, or no Option may.
I have tried removing Indexes all together and I can still see my directories. Maybe I'm in the wrong file, but from what I've read disabling directory listing has to be made here or .htacces (which I am trying to avoid.) In case it comes up I have made sure to restart XAMPP every time I made changes.
The error message is pretty clear. To rephrase / show examples:
# relative to whatever lower precedence section applies
Options -Indexes
If your goal is to turn off indexes. If you want to make sure FollowSymlinks is also set, put a + in front of it:
# relative to whatever lower precedence section applies
Options -Indexes +FollowSymlinks
If you want to turn everything but FollowSymlinks off:
# not relative
Options FollowSymlinks
Please go to file: /opt/lampp/etc/httpd.conf
and either comment the line like this:
#Options Indexes FollowSymLinks Includes ExecCGI
or edit like this
Options -Index
For Windows machine: Do same editing in file /apache/conf/httpd.conf
I put a "+" in front of word "FollowSymlinks" to have success.
And replace this lines:
AllowOverride All
Order allow,deny
To:
Require all granted
I hope to help you!
You can also use:
sudo a2dismod autoindex
I'm using Apache in my web server which resides in a public IP. I wan to be able to limit access of this whole site to the local network except for one file.
For example:
<Directory "/var/www/mysite">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order Deny,Allow
Deny from all
Allow from 192.168.1.1/24
</Directory>
would limit access to my website only to the people in that IP range. However, the file myfile.html also resides in that directory, and I want it to be visible publicly. Maybe:
<File "/var/www/mysite/myfile.html">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</File>
So my questions are: Does the <File> tag go inside the <Directory> tag or somewhere else? Will myfile.html be visible publicly even though it resides in a Directory that is only visible to a range of IPs? Do the configurations above look right? (I'm an apache noob) Is there a better way to this (maybe the firewall)?
Your input is appreciated.
I have been struggling with this problem for some time now. Let me break it down:
We have an apache2 server which hosts most of our company's websites. Each website is a separate vhost. One of this vhosts is used by our internal UI Designer to present his latest drafts and projects to both internal users and 3rd party clients. At the moment, this VHost is password protected from the Vhost configuration file using this directive:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
Allow from all
AuthUserFile /home/secure/passwords
AuthName "Username and password required"
AuthType Basic
Require valid-user
</Directory>
What I need is to make this website available (so NO password prompt) to our internal users meaning a specific IP range. I have tried to use the Allow from 192.168.xxx.xxx option in the above instruction set. However this is not letting the internal IP through (still asking for a password). So I tried to use our company's external IP address (which you can find on any "what's my IP website"). No luck with that either.
So for my last attempt, I have created a second vhost which obviously uses a different ServerName. Also, in order not to have any conflicts in the configuration file, I have created a symlink to /var/www and called it www2. Therefore, the Directory directive in the second vhost file looks like this:
<Directory /var/www2/>
Options Indexes FollowSymLinks MultiViews
AllowOverride none
Order allow,deny
Allow from all
</Directory>
However the configuration files are clearly conflicting because with the current configuration I get password protection on both hosts. If I disable this in the first Vhost, I lose it on both.
There is no .htaccess file in any of the directories, so there is nothing there to overwrite the configuration. The apache2.conf file has nothing defined related to Auth.
I'm not sure if you require more details, but feel free to ask me anything.
I appreciate the help!
----edit----
I just want to specify that I can't say 100% that my method of doing it is the correct one. Maybe setting up 2 VHosts isn't the solution to my problem. If anyone thinks of a better way of doing it, I'm open to suggestions. Bottom line is that I need one website to be available to internal users and password protected for anyone else.
Cheers!
have you tried to solve this using Satisfy Directive of Apache?
For example:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
Allow from all
AuthUserFile /home/secure/passwords
AuthName "Username and password required"
AuthType Basic
Require valid-user
Allow from 192.168.1
Satisfy Any
</Directory>
More information can be found here