Apache2: userdir module - apache2

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.

Related

Bitnami Lamp stack subdomain

I purchased a bitnami lamp stack Server from aws and create a laravel Project. The page is reachable and works so far. Now I would like to create a subdomain.
I tried following:
Inside here:
/opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf
I changed following:
# Bitnami applications installed in a prefix URL
#Include "/opt/bitnami/frameworks/zendframework/conf/httpd-prefix.conf"
Include "/opt/bitnami/frameworks/laravel/conf/httpd-prefix.conf"
#Include "/opt/bitnami/frameworks/laravel/conf/httpd-vhosts.conf"
Include "/opt/bitnami/apps/phpmyadmin/conf/httpd-prefix.conf"
to following:
# Bitnami applications installed in a prefix URL
#Include "/opt/bitnami/frameworks/zendframework/conf/httpd-prefix.conf"
Include "/opt/bitnami/frameworks/laravel/conf/httpd-vhosts.conf"
Include "/opt/bitnami/apps/phpmyadmin/conf/httpd-prefix.conf"
And finally made a Server Restart:
sudo /opt/bitnami/ctlscript.sh restart apache
But the subdomain / page does not Show up, the main page still works.
Is there any step which I missed?
Bitnami Engineer here.
You are including the "/opt/bitnami/frameworks/laravel/conf/httpd-vhosts.conf" file inside the bitnami-apps-prefix.conf file that is included in the default Virtual Host of Apache, that's why you can't access the application in the subdomain. Instead of adding this line
Include "/opt/bitnami/frameworks/laravel/conf/httpd-vhosts.conf"
in the bitnami-apps-prefix.conf, you will need to include it in the /opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf one. This way, you will define a the new Virtual Host after restarting Apache.

How to obtain the absolute path of apache userdir

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.

Apache2 configuration issue - Avoid file accessing without extension

I'm developing a website and having development environment as Ubuntu 14.04, PHP 5.5.9, Apache 2.4.7. My issue is if some want accessing a file like http://domain.com/robots(without extension) then I should avoid but I've to allow if some tries to access http://domain.com/robots.txt(with extension).
Now in both ways I'm able to access files, I want to avoid this when user haven't given extension of the file using .htaccess or apache configuration file.
My previous environment was Apache 2.2 and PHP 5.3.10 at the time with default Apache configuration it was working as expected but after upgrade its not working as expected and due lack of knowledge on Apache configuration I'm unable to pick those lines of code.
Add following line in .htaccess
Options -Multiviews

displaying html page through apache

i am using ubuntu and i have a html page named first.html at home/sanu directory and i have apache2 installed and running.i want host this page through apache from my pc how can i do that. (My pc's IP is :218.248.80.51) .i have tried to access "http://218.248.80.51/sanu/first.html" but its not working(Google Chrome could not connect to 218.248.80.51) in my browser.plz help me.
By default Apache points to /var/www on ubuntu, it would required extra configuration to get it to point at your home directory. Try moving your html file there, then you should be able to access it through your browser at http://localhost/first.html
To host the page for public viewing you'd need to configure your pc's & router's firewalls correctly to allow port 80.

how do i use apache2 server for hosting a website?

I am using ubuntu and I have some html pages. I want to host a website from my PC at my home. How can I do this using apache2? I am new to Apache2 if any one knows how to do this, please let me know.
The easiest way to publish HTML files with apache is by putting them in /home/your-user-name-please-do-replace-me/public_html, making sure that your apache is installed and then start apache. How to make apache start after a reboot, see this forum post on Ubuntu Forums.
When you have apache up and running, find out your servers IP-address (http://whatismyipaddress.com/ is pretty handy for this) and then your files will be accessible from: http://you-ip-address-whatever/~your-user-name-please-do-replace-me
You could always use services like http://www.dyndns.com/ so that you don't have to use your IP-address all the time.
Once apache is installed you should find that you can place content in a directory silimar to /usr/www or /usr/share/www and apache will serve it. You may also need to start apache, I don't know the ubuntu command but on fedora 12 it is:
service httpd start

Resources