Root directory of web server - apache

What is the root directory of Apache Web Server?
I am using Windows XP. My Apache server is installed at:
C:\Program Files\Apache Software Foundation\
I want to host a server and its manual says:
move all files and subdirectories from that directory to the root directory of the web server

It depends on how you've configured the server. The 'root directory' is actually called the document root, which is the directory from which the Apache HTTP server would serve files from. It can be changed using the DocumentRoot directive, which you should be able to find inside the configuration file(s) (e.g. /etc/apache2/apache2.conf).
From the documentation:
For example, if DocumentRoot were set to /var/www/html then a request for http://www.example.com/fish/guppies.html would result in the file /var/www/html/fish/guppies.html being served to the requesting client.

Related

Separate out configuration in apache http server

I have installed Apache Http Server 2.2. I know it is old but need to do some analysis.
I can see there is configuration file name as httpd.conf (found at location InstallDIR\Apache Software Foundation\Apache2.2\conf).
Some places i found they have maintain ssl configuration separate file name as ssl.conf and other configuration in separate file name as local.conf file.
But i can see no such files are present on my conf folder.
Can you please help me here how I can do separation ?
Note: Apache Http Server installed on Windows machine.
Thanks in Advance.

http://localhost is getting forwarded

I am using Xampp and in my htdocs directoy I have a folder called 'task4u'. If I go to http://localhost, I'll get forwarded to the page of 'task4u' (which is a Symfony 4 application).
In htdocs I have now created a new folder for a new website but I still get forwarded to the directory 'task4u'.
I have checked the windows file 'hosts' but there is nothing related to this issue.
Where could that forwarding be set? Is that because of Symfony itself maybe?
Windows host file contains only a redirect to 127.0.0.1 (loopback address) for "localhost" (or you can configure more redirects to 127.0.0.1).
You have to give a look to httpd.conf Apache file; it should be under this path for a XAMPP installation: C:\XAMPP\apache\conf\httpd.conf. Open httpd.conf with a text editor and change it with your new directory path under DocumentRoot C:/your/path and < Directory C:/your/path/>
Remember to restart Apache server by XAMPP interface.

How do I make the Apache Server point to the /var/www/html directory

In a new RHEL 7.5 server, I have created a var directory and within that the /www/html directory in which my website resides. When I try to access the website, I get the Apache Server Test page and mentions that the Apache server is running and I need to point to the /var/www/html directory.
How do I point the Apache Server to the /var/www/html directory?
You need to configure the available-sites and enabled-sites and remember to restart apache after changes in the config files.
Have a look at this guide:
https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts#step-four-%E2%80%94-create-new-virtual-host-files

How disable direct call files on web dirrectory?

My server was built on Apache and Nginx.
There are some directories with js scripts Node on root directory web site.
Via url address i can call direct file such like: domen.com/node/notific.js
How as it can be blocked?
I saw apache tutorial and found that it possible set in apache2.conf, to specify here in the Servername part param index-options, but it acts only on the prohibition directories.
And what you advice check me for more security my directories?
Thanks

PHPMyAdmin and Security on XAMPP not working after changing DocumentRoot in httpd.conf

SUMMARY
I am unable to run localhost/phpadmin and localhost/security after changing the DirectoryRoot in XAMPP httpd.conf. This leads to two questions.
If I am using XAMPP on Windows, is there any way to run PHP files outside the localhost directory that I have set in the httpd.conf?
If "no", then how does one run files such as phpmyadmin or the security module on the local machine, if the phpmyadmin files reside in the c:\xampp directory but the DocumentRoot path in httpd.conf points to a different directory?
More detail is set out below.
BACKGROUND INFO
My installation is as follows.
Operating system: Windows 7
Version of XAMPP: xampp-portable-lite-win32-1.8.1-VC9.7z
Installation directory: c:\xampp-portable
Code files saved in: d:\dropbox\websites_user1\...
I then modified the httpd.conf as follows:
Line 191: DocumentRoot "D:/Dropbox/websites_user1"
Line 222: <Directory "D:/Dropbox/websites_user1">
The default httpd-xampp.conf configuration is unchanged - e.g.:
Line 99: Alias /phpmyadmin "/xampp-portable/phpMyAdmin/"
Line 100: <Directory "/xampp-portable/phpMyAdmin">
Line 121: <LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
THE PROBLEM
After changing the directory root in httpd.conf as above, I can run php files successfully from local host - e.g. localhost/project01/demo.php.
However, I now can't run PHP files from any location other than those located in the new localhost directory (i.e. d:/Dropbox/websites_user1/..). This means that I can no longer run PHP files in locations such c:\xampp\PHPMyAdmin or C:\xampp-portable\security\htdocs\security.php.
Also, the configuration for the PHPMyAdmin and Security are clearly no longer correct. For instance, if I enter "localhost/phpmyadmin" or "localhost/security", I get a "page not found" error.
This leads to two sets of questions (as summarised at the start of this question).
Is the directory configured as the localhost the ONLY location from which PHP files can be run? Is it possible to configure PHP to run from any location on my C or D drives?
If not, how do I run files such as those in PHPMyAdmin or security.php or any of the innumerable files in the other xampp directories? Do I need to copy and paste the phpmyadmin folder into my localhost folder at D:/Dropbox/websites_user1? Or into each of the individual website folders beneath that? If yes, do I then need to reconfigure any files such as http-xampp.conf?
I am relatively new to PHP and new to XAMPP. Everything was working perfectly until I ran into this ... and now I'm completely stuck if I can't use PHPMyAdmin, and can't even use the Security module to set my passwords.
Will be very grateful for advice!!
I believe you cant run anything higher than your root as a security feature. Imagine some remote person knowing your IP address and accessing all your files above your document root.