Not following symbolic link after changing remote server PHP - apache

After changing remote servers (but not the content being hosted in it), my symbolic links are no longer being followed by apache through virtual hosts.
When I go into the terminal and perform ls -alt it shows that the symlink is there and correct.
The path where the symlink is going to (and suppose to be going to is correct) and the content expected is still there.
I have performed svn switch on the root of the content that the symlink is going to so its updated to the current server.
I have checked and opened up all file permissions for the content and subdirectories
I have tried svn switch on the content that s symlinking to the shared content, but am presented with this error:
'.' appears to be part of version 1.7, please upgrade your client version.
I deleted the folder with symlink and re-checked it out through the new server, this is where the symlink doesnt work anymore.
Some of my older projects that were checked out through the old server do follow the symlink to the content with the svn re-directed to the new server.
Also my virtual host which states the option to follow symlinks has multiple places where the same symlink path is used. Each folder inside this vhost has the same substructure to it, but oddly some symlinks work, and others dont.
Any ideas on what I could try to get apache to follow the sym links?
Thanks a lot

Following symlinks is OFF by default on most Apache installs, because they're a security risk - they allow easy violation of document root "jails". if you allow symlinks, it's trivial to have something like ln -s / /site/documentroot/browse and now your entire filesystem is open for viewing by the world.
If you insist on allowing them, then you'll need
Options +FollowSymLinks
in the appropriate <directory>, <virtualhost> or .htaccess1. Relevant docs: http://httpd.apache.org/docs/current/mod/core.html#options

Related

PHPmyadmin and Wordpress directories access denied

Running wordpress locally on a centOS 7 server running the latest apache, PHPmyadmin and mariadb-server.
IP/wordpress and IP/phpmyadmin on systems within the local network yields "403 forbidden" "you dont have permission to access (directory) on this server."
How can I fix this to allow the website to be seen on the public internet?
Could be a lot of things.
In your main Apache configuration file (e.g. /etc/httpd/conf/httpd.conf on Arch Linux), confirm your DocumentRoot path. The files you want to serve must reside there, or in sub-directories from there (If not, you might want to use an Alias to specify another path). Since you call IP/wordpress and IP/phpmyadmin, then you probably have directories called wordpress and phpmyadmin under your DocumentRoot path.
You also want to check the Directory groups in your Apache configuration file. Under those, the main culprit would be the Require directive set to all denied or something else too much restrictive like ip your_ip.
Finally, PHP can restrict path access with the open_basedir directive. Look for it in your php configuration file (e.g. /etc/php/php.ini on Arch Linux). If the line is commented, you're fine. But if a path is specified, your wordpress and phpmyadmin files must reside there.
Depending on your setup, any directive mentioned above could be in another Apache configuration file (e.g. /etc/httpd/conf/extra/* on Arch Linux).
Take a look at Apache and PHP online documentation for information about those directives.
Probably there is an issue with your directory privileges.
Use the follwing command to check it:
cd your_site_directory
ls -l
You can have a look to have a better understanding on directory privileges here.
As mentioned here apache runs under "apache" user.
Have a look at this post here to fix the issue.
All files should belong at least to apache group. To do it you can use
cd your_site_directory
chgrp -R apache ./*

Apache URI path recognition / mapping?

I have a website for all intents and purposes is called.
www.foobar.com
Which in my server path is /var/www/
I tried to create a new folder in /var/ called "analytics", with the hope that if I typed www.foobar.com/analytics I could access that folder.
However that does not work because it is actually looking for /var/www/analytics instead of /var/analytics
So how can I have multiple directories mapped to a URI?
For phpmyadmin I can access www.foobar.com/phpmyadmin with the phpadmin folder is in a completely different directory. So it must be possible.
However I tried googling but could not find any answers so I guess I do not have the right description of what this functionality is on Apache webservers.
Any help would be appreciated.
You have to create virtual directories in Apache.
If you are using Apache2, then can you go to the directories
/etc/apache2/sites-available and /etc/apache2/sites-enabled.
You have probably only the default virtual directory enabled.
You can make a copy of a virtual directory in the map /sites-available.
A virtual directory starts with specifying what the root directory is.
Then can you use the commands a2ensite and a2dissite in order to enable or disable the virtual directories respectively.
After a change in enabled/disabled virtual directories do you need to restart/reload the apache server.
If you use .htaccess file, do not forget to set AllowAccess (in the tag Directory) to at least FileInfo or .htaccess will be ignored.
If you want to make those directories different hosts, then can you make aliases in /etc/hosts.
On my home computer have I aliases for the ip addresses 27.0.0.1 and 27.0.1.1.
That gives me the possibility to have two different sites at the same time.

Apache: Copied files from another directory do not work

I recently set up my Apache server (2.2) with PHP (5.3) on my Oracle Linux computer. Initially, I created three files: index.html, index.php, and countries.html. I believe (do not recall 100%) that I created these files in my /var/www/html/ folder, and these files were automatically given root permissions for both owner and group. However, when I copied my index.html into my home directory (not root), I was no longer able to access the file (403 Message - Forbidden access), even after I moved it back into it's original /var/www/html/ folder and changed its permissions for owner and group back into root.
Notably, my index.php file was the default page, even though it wasn't listed in the DirectoryIndex. Furthermore, I experimented with my index.php file by copying it, deleting the original, moving the copied version back into the /var/www/html/ folder, and changing the permissions. Same result, where it didn't work. Only difference is that the php file threw an internal server error (HTTP Error 500).
I have added my countries.html file into my DirectoryIndex line, and it will now display as the default page. However, if I remove it and leave my DirectoryIndex line as it is:
DirectoryIndex index.html index.html.var
then it will default to my index.php page and output the internal server error.
Right now, I see a couple of problems:
The copied files do not work, despite having the same permissions. I believe my experiment with copying the index.php file is proof of this.
The default page, which was index.php, is not listed in the DirectoryIndex, yet it still is the default.
Any help/insight would be appreciated.
This might also happen in case when you are using old php version and in your php file there is some syntax related to new php version. As in php 5.3 we don't have short array notation but in 5.5 we have also in 5.4 i guess that also can gives internal server error.
See your php version by
php -v
and if its version 5.3 or less check your php file if contains any new things like new short array notation [].
Don't know am i talking in the same context in which you want. As i didn't understand the question very well.

Apache 2.2 on XP: How configuration files are managed? Where should they be located?

New to Apache, and suffering...
Seems to be true:
the default configuration is in Apache directory Apache2.2/conf/httpd.conf
Unsure of that:
it can be elsewhere
to create some separation between test/production, it seems that the best option is
to store all test files, including configuration and logs, in the same directory, with subdirectories conf, log, htdocs, and all production files in another directory using a similar structure.
if my upper directory is d:mywww, then the server needs to be started with the associated configuration file, e.g. httpd -f "d:mywww/conf/httpd.conf"
What will happen to the default configuration file if the -f option is used. Will it be ignored?
If instead of the -f option, you use httpd -d "d:mywww/htdocs" to indicate the directory to serve, but not any configuration file, will the default config file be used and the one under d:mywww/conf ignored?
Can someone confirm or deny?
Is there a well known site with a good introduction on setting up Apache, if possible on Windows. I found the Apache documentation a little bit difficult, and Apache Definitive Guide not clear about this kind of questions.
I was new to Apache 2 months ago, and still suffering. Since you got no replies from pros yet, I'll chip in my 2 cents: (all for Ubuntu 10.10)
httpd.conf is used for your personal configurations, so I'd say that it is not the default configuration file as you specify. The default would be, in my case at least, in /etc/apache2/apache2.conf
you can have a bunch of other conf files. In my case, I can place any file with an extension .conf inside /etc/apache2/conf.d/ and it will be picked up by Apache on restart.
Don't know about the rest. Hope it helps you

Difference between ServerRoot, DocumentRoot, and Directory

While playing with Apache, I messed up the paths without making a backup httpd.config file.
The file is located at C:\xampp\apache\conf\httpd.config
I want to keep my web project on the D: drive as a virtual folder. This is the current non-working state. How can I fix this or revert to the xampp defaults?
ServerRoot "C:\xampp\apache"
DocumentRoot "D:\workspace"
<Directory "D:\workspace\AutionWebSite">
ServerRoot = path to the webserver executable/dir
DocumentRoot = path to your files that are delivered by the server
The <Directory> directive is used to configure settings for a specific directory. However, the <Directory> command in your question is not complete.
The default values for DocumentRoot and Directory for XAMPP is "C:\xampp\htdocs"
I would say that the most easiest way for you would be to check your xampp version, make a back up of your document root, which is probably "www" or "htdocs", your configuration files and eventually dump your database. Now install the same version of xammp again and there it is.
And at least the first rule is by playing with "config files", make backups before. The second rule is, make a backup of the whole configuration directory anyway, just for the case. And the last one is, if you are a xammp user, means you are a windows user, so you probably don't have unixoid server administration knowledges, so there is a long way for you to starting to "play" with the apache server.
The only think that you should know is, that you need to set the direction "AllowOverride All", which is necessary, if you use some content management system or other systems, which brings there own .htaccess file. So long you work on windows with xammp and not on a linux or other unixoid operating systems, you cannot understand the complete world of web servers like apache or database servers like postgresql and the sensibility of configuration files.
I understand the necessity of it for understanding of whole web applications respect. to be an full stack web programmer, but before that, i wouldn't change in the future the default server configurations, just check the row "AllowOverride All". Hope this will help your.
Server Root "/Local"
-specifies the default directory hierarchy for the Apache installation.
Document Root"/Local/WWW/apache22/data"
- the directory out of which you will serve your documents.