EasyPHP modules folder conflicts with Drupal - apache

I installed EasyPHP and set up a Drupal installation and a virtual host, so that I could see my site at sitename.local in my browser.
At first, it seemed like it was working, but it looked odd. The size of the text was different and certain page elements were displayed that were supposed to be hidden.
I found that the CSS was not loading from /modules/system. This was odd, because other CSS files would load fine. When I tried to access those CSS files directly, EasyPHP would throw "Object not found!"
So I tried navigating in my browser to sitename.local/modules. I would expect it to say "Access forbidden", but instead it showed the index of the EasyPHP modules folder.
I looked in httpd.conf and found this line, which seems to be the culprit:
Alias /modules "${path}/modules"
If I comment out that line, my site works normally, but I run into errors in EasyPHP because the module path is not found.
Is there way to rewrite this line so that it only redirects 127.0.0.1/modules and not sitename.local/modules?

Jus run into the same problem on EasyPHP 14.1VC11 and Drupal 7.26
Adding alias in virtualhost configuration worked for me:
<VirtualHost *:8080>
DocumentRoot path-to-site-folder
ServerName site-name
Alias /modules "path-to-site-folder/modules"
<Directory "path-to-site-folder">
Options FollowSymLinks Indexes
AllowOverride All
Order deny,allow
Allow from 127.0.0.1
Deny from all
Require all granted
</Directory>

The correct answer is actually the answer posted by #ahokkonen, but without the **.
So, adding Alias /modules "path-to-site-folder/modules" solves the issue (I just did this and it works.

Related

Is it possible to change Apache web root directory on Ubuntu except home directory?

Can't change Apache web root directory on Ubuntu.
file exists in sites-enabled folder
I changed /etc/apache2/sites-enabled/mynewsite.conf file document root
<Directory /media/saptarshi/BAAA7114AA70CDFF/webdev>
Options Indexes FollowSymLinks
Allow from all
AllowOverride None
Require all granted
</Directory>
and, also I changed /etc/apache2/apache2.conf file document root
<Directory /media/saptarshi/BAAA7114AA70CDFF/webdev>
Options Indexes FollowSymLinks
AllowOverride None
Allow from all
Require all granted
</Directory>
After changing those I restart the apache then it not worked. Shows
403 error. Forbidden
You don't have permission to access this resource. Apache/2.4.41 (Ubuntu) Server at localhost Port 80
But magically when I change the path within the home directory(/home/saptarshi/test) then it work. So , Is it possible to change apache root directory outside the home folder in ubuntu?
Two things I would like to mention. Firstly, because of something isn't working, don't write the same configurations into multiple apache config files. It will create more problems rather than solving one. Secondly, you should always edit the respective site config file in the /etc/apache2/sites-available/ directory rather than editing the file in the /etc/apache2/sites-enabled/ directory. It's a symlink, so, it's always better to edit the main file and reload the config.
Now your problem might or might not be related to directory path only. It might be a user permission related problem as well. Could you please attach the entire apache2.conf file and the mynewsite.conf file? Also, what's the host you're trying to access it with?

Apache2 403 Forbidden in custom document root

I have searched anything on this topic in the internet and i just cannot get it to work. I am desperate....
I just want to access my index.php inside a custom document root folder but i keep getting this error
The new document root that i want instead of the /var/www/html default is called
/home/ever/FH/SKS/frontend
I have set all the permission recursively to 775 for this folder and all subfolders.
The main apache configuration file /etc/apache2/apache2.conf looks like this:
Most instructions i have found on how to set a new directory root, told me to just change the path inside the /etc/apache2/sites-available/000-default.conf file to point to my new document root.
My 000-default.conf:
I also tried a version of the 000-default.conf file that looked like this:
The symlinks should be corrrect:
I have not set up any .htaccess file or changed anythign else.
Please help me... i am desperate. In XAMPP this is done super easy, but i refuse that this cannot be done with the normal Apache server too. It cant be THAT big of a deal can it ?
It seems that in version 2.4 of the apache webserver i have to use
<Directory /var/www/foo>
Require all granted
</Directory>
instead of 2.2 syntax
<Directory /var/www/example.com>
Order allow,deny
Allow from all
</Directory>
furthermore i have to place the configuration inside the
/etc/apache2/apache2.conf
file instead of the
/etc/apache2/sites-available/000-default.conf
file.
My apache2.conf now looks like this:
allowing me to finally access the file WITHOUT PHP support it seems....
but this is another long complicated battle that never happened before with XAMPP i guess.....

XAMPP Virtual Host wildcard subdomains on Mac

I want to set up my virtual hosts in a way so that I don't have my projects in the htdocs folder and I would like to use subdomains to get to them. So for example instead of going to "http://localhost/myproject" which would be located inside "/xampp/htdocs/myproject", I'd rather like to go to "http://myproject.sites.local" which would be located inside "/Users/myname/Projects/myproject".
I know I have to go to httpd.conf inside the "etc" folder in xampp and uncomment the line that includes virtual hosts, done that. Then I went to "/etc/hosts" file to add "127.0.0.1 sites.local" and after that I have this chunk of code inside my httpd-vhosts.conf file:
<Directory "/Users/marioplantosar/Projects">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<Virtualhost *:80>
VirtualDocumentRoot "/Users/marioplantosar/Projects"
UseCanonicalName Off
</Virtualhost>
<Virtualhost *:80>
VirtualDocumentRoot "/Users/marioplantosar/Projects/%1"
ServerName sites.local
ServerAlias *.sites.local
UseCanonicalName Off
</Virtualhost>
The first part works I guess because if I visit "http://sites.local" it opens the Projects folder root (it just lists the subfolders because there is no index file inside of the "Projects" folder. But the other part is not working and it just throws the "ERR_NAME_NOT_RESOLVED" error. So I have the wildcard "*" in the ServerAlias so that it catches every subdomain of sites.local, and I use the "%1" to open the corresponding folder inside "Projects" folder, however it's just not working. The weirdest part is that it worked for months up until yesterday and I have no idea what happened that it just suddenly stopped working.
I figured out the problem. Everything I wrote in the question was configured correctly, but since I was doing all of that little over a year ago I totally forgot about the dnsmasq part which somehow got messed up. "hosts" file doesn't support wildcards so you have to use a tool like dnsmasq that does the dns masking automatically for every folder inside my "Projects" folder.
For anyone that gets into a similar situation like me, you configured everything in httpd-vhosts.conf, httpd.conf and hosts files correctly but it's not working you should follow this tutorial to set up the dnsmasq: https://passingcuriosity.com/2013/dnsmasq-dev-osx/

Apache VirtualHost Loading the Wrong Page

Problems
An Apache VirtualHost keeps loading the wrong directory when I'm telling it to load a completely different part. Here is what I have for the VirtualHost:
<VirtualHost *:80>
DocumentRoot "/Workspace/Font"
ServerName fonts.wrks.tk
# ErrorLog "/Logs/Workarea/Fonts/Error.log"
# CustomLog "/Logs/Workarea/Fonts/Access.log" common
<Directory "/Workspace/Font">
AllowOverride all
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
So, the problem, I'm telling it to load /Workspace/Font But it's not, it's loading /Workspace instead. I'm not sure how this came to be.
Attempt at Solution
There's not much I could do considering that the search on Google gave me no relevant results on what I was trying to fix. But regardless, here is some things I did myself to try and fix it.
Restarted Apache Multiple times
Changed permissions around:
sudo chown -R daemon:daemon /Workspace/Fonts (I run XAMPP, and the user and group is daemon)
Checked Error Logs (Nothing Relevant to the problem was printed)
Created a index folder and/or tried to access folder and files within the domain.
It turns out I didn't have the VirtualHosts line uncommented, thanks for anyone that helped in the past. But everything works now.

Apache local configuration to resolve files correctly

I have just configured Apache and PHP to work on my local Mac OS X computer. Now PHP works fine, except when I try to load the files for my live sites. The live sites have separate directories and are sorted by client name etc.
I've created symlinks in the default root for the local web server documents. My issue is that Apache doesn't seem to want to load any of the relative paths that are found in the HTML pages. For example, I have src="/css/main.css" but Apache doesn't load the file, similarly for images, it just resolves as a file not found 404 error. I then thought it might be the symlinks so I copied the full directory into the Apache document root, and still had the same result.
I would really love to setup my local development environment to run Apache, PHP, MySQL to develop locally then publish when ready. I also tried the MAMP installation, and had the same issues.
First you might want to try using src="./css/main.css".
When dealing with multiple live sites I like to setup a single configuration file for each site with apache and then load them all together in the httpd.conf file.
for my setup it looks like this:
in
/etc/apache2/httpd.conf
I have:
# Begin virtual host directives.
Include conf/bortreb.conf
Include conf/rlmcintyre.conf
Include conf/laserkard.conf
Include conf/judyates.conf
and then in
/etc/apache2/conf/judyates.conf
I have:
<VirtualHost *:80>
#localhost site
ServerAdmin email#example.com
DocumentRoot "/home/r/Desktop/web/judyates"
ServerName localhost
ServerAlias judyates.localhost
ErrorLog "/home/r/Desktop/web/judyates/log/error_log.log"
ScriptAlias /cgi-bin/ "/home/r/Desktop/web/judyates/cgi-bin/"
<Directory "/home/r/Desktop/web/judyates">
Options Indexes FollowSymLinks
Options +ExecCGI
AddHandler cgi-script cgi pl py
AllowOverride Options
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
#live site
ServerAdmin email#example.com
DocumentRoot "/home/r/Desktop/web/judyates"
ServerName judyates.com
ServerAlias *.judyates.com
ErrorLog "/home/r/Desktop/web/judyates/log/error_log.log"
ScriptAlias /cgi-bin/ "/home/r/Desktop/web/judyates/cgi-bin/"
<Directory "/home/r/Desktop/web/judyates">
Options Indexes FollowSymLinks
Options +ExecCGI
AddHandler cgi-script cgi pl py
AllowOverride Options
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
This way works really well, because you can set the subdomain yoursite.localhost
to loop back to your home ip address.
With this setup, when I work on judyates.com on my computer and want to test anythig, I just go to judyates.localhost in my web browser.
I have about 5 other sites all set up this way in their own *.conf file, so they can each live in their own directories on my computer that exactly match the directories they'll be in on the server.
The key is to use virtual hosts to go to different sites based on the subdomain.
You can learn how to configure subdomains that point to yourself here:
http://digitalpbk.blogspot.com/2007/01/making-subdomains-on-localhost.html
My setup goes even one step further because I setup the server too. Whenever I want to update I load both the webfiles AND the apache config files, and that way the server exactly mirrors my local setup. The only difference is that the real judyates.com points to the server and not my home computer, so when people try to visit the site they get everything from the server.
Have you tried src="css/main.css"? That is, without the leading slash? If you have a leading slash there your files would have to be in a directory named css that was in the root directory of the webserver, and if I understand you correctly that's not the case.
EDIT: OK, from reading your comments it seems like you are not quite clear on how relative urls work. "/css/main.css" is not relative to the page's location in the directory tree. It means a file named "main.css" in a directory named "css" in the root directory of the webserver. When you put your files on the deployment server your css directory is at the webserver's root directory. But it sounds like you are currently putting the css directory in a subdirectory named for the client... so your css file is now living at "/clientname/css/main.css".
If I understand you correctly, you can do what you want by using relative urls. If your html file is in the same directory as the css directory you would need "css/main.css". If it's in a subdirectory of the directory that contains the css directory you would need "../css/main.css"- the ".." means the parent directory of the current directory. If you use relative urls they will continue to work as long as the relationship between the files doesn't change.
Here's a page on the subject that explains it adequately, I think: http://www.webreference.com/html/tutorial2/3.html. Was pretty much the first thing I found in Google though, so there are likely better explanations out there.
There are a number of Apache directives that you could use to do this, but if using relative urls would work for you (and if I understand you correctly it would) then that's likely to be a lot simpler and less likely to cause you further trouble.