Domain alias in xampp - apache

I'm trying to place a domain alias named noetic.dev, I'm having a fresh laravel installation in the htdocs folder named noetic.
For achieving this I tried to change httpd.conf file and added this:
Alias /noetic.dev "F:/xamp/htdocs/Noetic/public/"
<Directory "F:/xamp/htdocs/Noetic/public/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require local
</Directory>
and I changed following in httpd-vhosts.conf:
<VirtualHost *:8082>
ServerName noetic.dev
DocumentRoot c:/wamp/www/NitsEdit/public
</VirtualHost>
and similarly I've in the hosts file:
127.0.0.1 noetic.dev
Now while trying the link to be as http://localhost:8082/noetic.dev/ I'm getting the result but while trying noetic.dev:8082 I'm getting an error
Access forbidden:
You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.
If you think this is a server error, please contact the webmaster.
I don't know where I'm doing wrong, guide me in this.

For Vhost you have wrong path of C:/
DocumentRoot c:/wamp/www/NitsEdit/public
that should be
DocumentRoot F:/xamp/htdocs/Noetic/public/

Related

Xampp apache virtualhost

I have two "htdocs" folder for two websites. I named the folders "website1" and "website2".
As you can see, both folders are inside C:/xampp.
When I type "website1.com" on my browser, I want xampp to serve the files on folder "website1" and its subfolders/subfiles as needed.
When I type "website2.com" on my browser, I want xampp to serve the files on folder "website2" and its subfolders/subfiles as needed.
For simplicity, let's say the landing page is index.php (think of sign-in page). This is the page called when I type "website1.com" or "website2.com".
Then after I hit submit button on index.php, it will call main.php.
I edited two files.
For hosts file, I add the host name that I wanted to be resolved into my localhost. Since I want to serve both website1 and website2 on my local computer via xampp, I added the following lines on hosts file located on C:/Windows/System32/drivers/etc
127.0.0.1 website1.com
127.0.0.1 website2.com
I also edited the apache config file which is httpd.conf
I added the following after the line: Listen localhost:80
<VirtualHost website1.com:80>
DocumentRoot "C:\xampp\website1"
ServerName website1.com
<Directory "C:\xampp\website1">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
<VirtualHost website2.com:80>
DocumentRoot "C:\xampp\website2"
ServerName website2.com
<Directory "C:\xampp\website2">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
The current behavior with these configs is that:
Typing "website1.com" or "website2.com" directs me/loads the page properly. For simplicity, the index.php of website1 has just different text compared to website2.
The problem is, once I hit submit button and it tries to load main.php (DIFFERENT folder locations depending if website1 or website2 but SAME file name), I get the following error:
Any help would be appreciated. I am new to web development.
I am also new to this topic (virtual hosts). I happen to search for this because I am getting tired of renaming my htdocs folder. RIght now, when I want to test website1, I rename website1 folder to htdocs. I am thinking that if what I am trying is possible, it may save me time in the long run.

Apache 2: www.domain pointing to the wrong index

I am encountering a very strange behaviour with Apache 2 that I cant seem to solve. Essentially I have a domain, lets call it domain1.
http://domain1.ovh points to the correct folder.
http://www.domain1.ovh points to the folder of another website I am hosting with Apache 2. (Which is not intended, both addresses are supposed to point to the same folder and show the same page.)
I cant seem to find a way to fix this problem. I apologize if you find this question to be a repeat but I read all the suggested questions and none helped me.
Here is my Apache 2 configuration file:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName celtiberianproductions.ovh
ServerAlias celtiberianproductions.ovh www.celtiberianproductions.ovh
DocumentRoot /var/www/celtiberianproductions.ovh
<Directory />
AllowOverride All
</Directory>
<Directory /var/www/celtiberianproductions.ovh>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require all granted
</Directory>
ErrorLog /var/log/apache2/celtiberianproductions.ovh-error.log
LogLevel error
CustomLog /var/log/apache2/celtiberianproductions.ovh-access.log combined
</VirtualHost>
I must also add that in my domain provider control panel I am pointing both domain1.ovh and www.domain1.ovh to the IP address of the VPS machine I have with an A link.
Your Apache 2 configuration seems OK but your domain names point to different ip addresses:
https://toolbox.googleapps.com/apps/dig/#A/domain1.ovh
;QUESTION
domain1.ovh. IN A
;ANSWER
domain1.ovh. 3599 IN A 51.254.133.96
https://toolbox.googleapps.com/apps/dig/#A/www.domain1.ovh
;QUESTION
www.domain1.ovh. IN A
;ANSWER
www.domain1.ovh. 3598 IN A 213.186.33.5

Apache: 403 Forbidden when activate virtual host

i have an absurd problem with apache and CentOS, the webserver work in default mode, when go to http://myip i view correctly the apache test page. If add `/etc/httpd/conf.d/foo.conf
<VirtualHost *:80>
ServerName foo.local
DocumentRoot "/home/foo/html"
ErrorLog /var/log/httpd/foo.local-error.log
<Directory "/home/foo/html">
Options Includes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
I have 403 forbidden to ALL directory configured to apache, i do not see either the test page.
The directory /home/foo/html have owner and group apache, and permission 775 to directory and 664 to file. I see in the log:
AH00035: access to / denied (filesystem path '/home/foo/html') because search permissions are missing on a component of the path
If i deactive this conf file, apache works and see the test page
I have resolved changing the path, instead that /home/foo/html i put /var/www/foo and worked

Change the DocumentRoot folder in apache cause permission issue

I installed a LAMP in my AWS EC2 instance. The DocumentRoot folder is in /var/www/html. What I did is to copy the html folder into my /home/ec2-user and rename it to www. Then the DocumentRoot is changed to /home/ec2-user/www. Of course the https.conf is changed accordingly. Here it is:
#DocumentRoot "/var/www/html"
DocumentRoot "/home/ec2-user/www"
<Directory />
#Options FollowSymLinks
#AllowOverride None
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order deny,allow
Allow from all
</Directory>
#<Directory "/var/www/html">
<Directory "/home/ec2-user/www">
The problem is I got the following error message after I restart the https service.
You don't have permission to access / on this server.
The owner and the permission is the same for both folder. Here are the screenshots:
I searched in stack overflow and found some similar issues. But none of them work for me. Can anybody help? Thanks
the issue is the user apache runs as, is not ec2-user.
You could change it, but putting your doc root inside of the ec2-user's home directory is probably not a good idea. More then likely everything you do on your instance is as the ec2-user (who is a sudoer and has access to pretty much everything), so if someone was to compromise a script that apache is running, they would literally have full control over your instance.

Accessing to a file and folder in Apache from Localhsot

I want to create a virtual folder with a file in it in Apache, and to see that file from my browser : how can i fix it ?
the error i get when i try my local host in browser:
You don't have permission to access / on this server.
I tried:
1) created a folder in etc/apache2/sites-available
2) checking the default Apache settings which is not blocking my IP which is 192.168.1.5:
Assuming that you are trying to serve /yourfolder. Change the permission of the folder to give access right to others (755 for example) and add following to site conf you have created.
<VirtualHost *:80>
ServerName example.com:80
DocumentRoot /yourfolder
# Change according to your folder path
<Directory /yourfolder>
Order Allow,Deny
Allow From All
Options -Indexes
</Directory>
</VirtualHost>