How to obtain the absolute path of apache userdir - apache2

Is there any way to obtain the absolute path of the apache userdir (the path that http://localhost/~username/ maps to, given that it is enabled in the apache configurations). A table, which UserDir directives correspond to which paths can be found at https://httpd.apache.org/docs/2.4/mod/mod_userdir.html. For example,
UserDir directive used Translated path
UserDir public_html ~bob/public_html/one/two.html
UserDir /usr/web /usr/web/bob/one/two.html
UserDir /home/*/www /home/bob/www/one/two.html
I want to get the "Translated path" (preferably as absolute path) for the user currently logged in, given that it is enabled in the apache configurations. Of course I can find out manually but my question is how to determine it automatically. My hope was that there is a functionality like apache2 --show-current-userdir that just prints it.

Related

Apache Camel SFTP file download from specific directory

I used FTP component of camel but it could not download the files that I want.
<camel:endpoint id="ftpNotificationDownload" uri="sftp:/11.1.1.1://app/as?username=aa&password=1111&fastExistsCheck=true&localWorkDirectory=C:\\asd&download=true&throwExceptionOnConnectFailed=true&delay=4000&useFixedDelay=true"/>
I want all the files and folders to be downloaded under my local folder so I did not put filename option.
When I give the host name as 11.1.1.1, it works but when I set directory after host name like 11.1.1.1:/app/directory, it does not work.
I have checked SFTP server and it is up.
There should not be a colon (:) after the host name in the uri. And probably not even one of the two slashes. On the other hand, you are missing one slash after the sftp:.
See Apache Camels URIs syntax.
sftp://[username#]hostName[:port]/directoryName[?options]
Try
sftp://11.1.1.1/app/as?...
Note that this is true for any URI, not just Camel.

Apache2: userdir module

Recently, I installed Apache2 on mu Ubuntu machine (http://www.example.com) and I enabled userdir module. I wanted to know what userdir module actually does behind the scene. As I can access http://example.com/~theuser by properly configuring userdir module, does that mean it creates a virtual box for the specific URL http:/ /www. example. om/ ~theuser? If not, how virtual box concept is different that creating an URL http: //www. example. com/ ~theuser using userdir module?
Userdir module just maps the /~username/ urls to each user's own public_html directory or any other user specific directory you have configured. That's not a virtual box, it's just alias for a directory in a single web server.

Can't get Apache directory indexing to stop

I am trying to get my OSX MacPorts install of Apache to NOT show directory listings. I have tried various configurations of the "options" directive in the httpd.conf file with no luck. When I go to the site, it still lists the root directory (there is no index file at the moment.)
Apache has been restarted after each change.
There is no .htaccess file in the / directory, so there shouldn't be anything overriding.
This is driving me crazy!
So basically something is overriding your config. From the documentation of apache we can read that Options is can be placed in various context: server config, virtual host, directory, .htaccess.
httpd.conf is read first, so if You provided the configuration properly there, it means that it is overridden somewhere else
How did You do enter the options in the config ? In the most basic variant it should be.
<Directory /path>
Options -Indexes
</Directory>
Here what you should do:
check module configurations in modules for Options Indexes
check the main virtualhost definition, probably called default or 000-default
If it still does not help, add Options -Indexes to your virtualhost directly (provided you have not done it already). Or add it to the .htaccess file in your directory (allowing Options in .htaccess needs to be switched on)[as suggested in comments]

why does apache forbid access via symbolic links?

I am trying to install typo3 as per the instructions but I have a bit of a puzzle to solve.
It seems apache denies access to any files I try to access via any symbolic link in the site root directory. I have changed permissions from SymLinksIfOwnerMatch to FollowSymLinks and no joy.
I'm working on mac OSX (SL) and installing in my user's "Sites" directory. I can access any files in this CMS directory via the web browser just not anything through symbolic links.
I hope konsolenfreddy's comment was helpful already. I am trying to round things up here:
First check if the symlinks work from terminal and/or the filesystem in general.
Also, if you use absolute paths, the whole path from root to the file in question must be readable by the Apache user. *
If yes, check if the AllowOverride option is set for your webserver (or if applyable for the virtual host) For debugging you can set AllowOverride All in either apache2.conf, httpd.conf or in sites-available/default
If yes, check if FollowSymlinks is aktivated in any of the files responsible for your webroot, starting with apache2 working yourself down to the .htaccess files.
Try changing file permissions on the symlink file and the target directory (or files)
Try creating your own symlink and see what happens when you call it in the browser.
* Check this answer at askubuntu.com for more hints.
Ok I eventually solved it. In OSX the final file that governs access of sites installed in user directories is the last Include line in the apache2/conf/extra/httpd-userdir.conffile. Once I changed that my problems went away.
Thanks to all the people that replied my questions.

How exactly does Tomcat run out of CATALINA_HOME and CATALINA_BASE

I'm having trouble finding documentation regarding this. After some googling I find that bin, conf,logs, temp, webapps, work are directories that should exist in CATALINA_BASE.
temp, logs, webapps, bin and work I don't have any trouble understanding.
bin I suppose is just another bin folder, if for some reason both CATALINA_HOME and CATALINA_BASE are in PATH, then scripts in both folders will be available for execution.
But how about conf? Will the content of CATALINA_HOME/conf be totally ignored if CATALINA_BASE is set? Suppose I only would need to customize only a few config files pr. CATALINA_BASE, would I still need to keep a complete set of config files in CATALINA_BASE/conf, or could the standard config files in CATALINA_HOME/conf be shared?
And ditto for CATALINA_BASE/lib ... would this work as a "global" lib folder pr. instance?
You can find the answer in the Tomcat documentation:
http://tomcat.apache.org/tomcat-6.0-doc/RUNNING.txt
Advanced Configuration - Multiple Tomcat Instances
In many circumstances, it is desirable to have a single copy of a
Tomcat binary distribution shared among multiple users on the same
server. To make this possible, you can set the $CATALINA_BASE
environment variable to the directory that contains the files for your
'personal' Tomcat instance.
When you use $CATALINA_BASE, Tomcat will calculate all relative
references for files in the following directories based on the value
of $CATALINA_BASE instead of $CATALINA_HOME:
bin - Only setenv.sh (*nix), setenv.bat (windows) and tomcat-juli.jar
conf - Server configuration files (including server.xml)
logs - Log and output files
webapps - Automatically loaded web applications
work - Temporary working directories for web applications
temp - Directory used by the JVM for temporary files (java.io.tmpdir)
Note that by default Tomcat will first try to load classes and JARs
from $CATALINA_BASE/lib and then $CATALINA_HOME/lib. You can place
instance specific JARs and classes (e.g. JDBC drivers) in
$CATALINA_BASE/lib whilst keeping the standard Tomcat JARs in
$CATALINA_HOME/lib.
If you do not set $CATALINA_BASE, $CATALINA_BASE will default to the
same value as $CATALINA_HOME, which means that the same directory is
used for all relative path resolutions.

Resources