phpmyadmin as default site on dedicated server - apache

We build a Ubuntu 18.04 server dedicated for running phpMyAdmin.
Databases are on several different servers and are accessed remotely.
No other services or sites are running on this server.
We want the phpMyAdmin site to be the default site.
At the moment the server is showing a Apache2 Ubuntu Default Page.
Basicaly we would like that http://server/ is showing the same site as http://server/phpmyadmin.
We tried to setup a redirect which seems to get stuck in an infinite loop:
redirect permanent / /phpmyadmin
or
redirect permanent / http://server/phpmyadmin
The result is that there are numerous appends of the string phpmyadmin to the original url until the browser cuts the redirects off.

in your apache2.conf find this:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
and update /var/www/ to /var/www/phpmyadmin
or move phpmyadmin content to /var/www as you prefer

Edit the file /etc/apache2/conf-available/phpmyadmin.conf or /etc/phpmyadmin/apache.conf
Line 1 should looks like this : Alias /phpmyadmin "some/path"
Change it to :
Alias / "some/path"
And restart apache

In the answers given it was suggested to move the phpmyadmin installation one level up.
This was not possible in my case due to the installation being in a different path.
This however pointed me in a different possible direction to a solution.
Here is how we eventually made it work like we wanted to.
Just 2 simple steps in the end.
Remove the folder which is used by Apache as default. In my case this was the /var/www/html. I found this location in the file /etc/apache2/sites-available/000-default.conf. look for the value of DocumentRoot.
Create a symbolic link instead of the removed folder. The redirect is now taking place on the file system level before Apache accesses them. In my case this link looks like this:
lrwxrwxrwx 1 root root 22 Jun 17 12:31 html -> /usr/share/phpmyadmin/

Related

Setting sabre/dav to have root directory outside of apache web root

I am trying to set up a WebDav server using sabre/dav. I got it set up and running and as long as I serve up files form with in the web server root (like /var/www/mydocs) I can access them in read-write mode. However, when I move sabre’s root directory to be like /mnt/mydocs I can only access them in read only mode. I do not think it is file permissions because I set them up the same both places and gave apache full access to both. I think it might be apache directory access directives but I have not found any combination that works. The last thing I tried in the apache config file was something like this.
<Directory “/mnt/mydocs”>
Options +FollowSymlinks
AllowOverride All
Require all granted
</Directory>
Any ideas? Thanks for your help.

When typing "localhost" in the address bar, I want to see a directory of files/folders

I recently installed XAMPP. I notice that when I type 'localhost' in the address bar of my browser, it shows a nice XAMPP welcome page. But I wish I could figure out how to show a directory of files and folders in my htdocs. I've seen this work on my old stack - 'parent directory', etc.
I've been digging around my httpd.conf file, and have found things on Google about AllowOverride, etc. Other sources say I should write a .htaccess file, but I can't get clarity on how to tweek my settings somehow to make this work.
Thanks!
Turn on your directory listing in apache configuration filehttpd.conf
For example if you projects are in /var/www/html, edit httpd.conf to add
<Directory /var/www/html >
Options Indexes FollowSymLinks
</Directory>
Following this, restart the httpd service

Apache always get 403 permisson after changing DocumentRoot

I'm just a newbie for Apache. I just installed apache 2.2 on the FreeBSD box at my home office. The instruction on FreeBSD documentation is that I can change the DocumentRoot directive in order to use the customized directory data. Therefore, I replaced...
/usr/local/www/apache22/data
with
/usr/home/some_user/public_html
but something is not right. There's index.html file inside the directory, but it seems that apache could not read the directory/file.
Forbidden
You don't have permission to access / on this server.
The permission of
public_html
is
drwxr-xr-x
I wonder what could be wrong here. Also, in my case, I am not going to host more than one website for this FreeBSD box, so I didn't look at using VirtualHost at all. Is this a good practice just to change the DirectoryRoot directive?
Somewhere in the apache config is a line like:
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/usr/local/www/apache22/data">
You must change this path too, to make it work. This directive contains for example:
Order allow,deny
Allow from all
Which give initial user access to the directory.
one possibility that comes to mind is SELinux blocking web process from accessing that folder. If this is the case, you would see it in selinux log. You would have to check the context for your original web root with:
ls -Zl
and then apply it to your new web folder:
chcon whatevercontextyousaw public_html
Or, instead, if its not a production server that requires security (like a development machine behind a firewall), you might want to just turn selinux off.
Just one idea. Could be a number of other things.

MAMP just ONE virtual host not working

I wanted to start a (my first) wordpress project on my mac.
I run apache with MAMP, and wanted to make another (I allready have a few) virtual host for this particular project.
I added the host to my httpd.conf and etc/hosts file as i've done many times before.
When I browse to the url i've chosen I just end up in the directory that i've specified as root folder in my MAMP settings.
Apache seems to ignore the changes made in the httpd.conf file, but if I remove (rename) the httpd.conf file (to _httpd.conf) it apache doesn't start. so it looks like changes to this file are ignored, BUT if I put something wrong in the file apache doesn't start either...
this is what I put in the httpd.conf file to add a virtual host:
<VirtualHost *>
DocumentRoot "/Users/username/Sites/site_dir/"
ServerName local.sitename.com
<Directory "/Users/username/Sites/site_dir/">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
can this have anything to do with WP?
greets,
R.
On Windows:
Try putting it in the conf/extras/httpd-vhosts.conf instead and try
where port 80 is whatever port you have apache running on (:80 by default on windows)
and try not to use .org .com or any ending common on the web in your server name/alias use if you are developing the project on your localhost use something like sitename.local instead.
On Mac:
Not sure how it would work
On Ubuntu 11.04:
I just:
Set up a different vhost file for each site inside of /etc/apache2/sites-available
Then enable the site via a2ensite or just make a copy to the file using cp to the sites-enabled folder (all this is done via the ssh or a terminal on mac)
I then reload and restart apache and wallah!
I'm having a similar problem on one of my ubuntu servers. I'm doing something that I've done several times but all of a sudden it doesn't work. Go figure, lol! Typo? Who knows, definitely scour the web, an answer is sure to surface.

Broken links in local Wordpress site

I have a wordpress site set up on a live server, and I have replicated the site locally by following these steps:
FTPed live files to local
Set up virtual host (dev.domain.com) to point at local version of site
Imported the db locally
changed wp-config.php to the correct local db settings
changed 'home' and siteurl' in db.wp_options to point to http://dev.domain.com (from http://www.domain.com)
Home page loads fine, /wp-admin all loads fine.
Problem is in links to pages:
Permalinks are set to point to post name: http://dev.example.com/sample-post/, just as on live server. However, locally, all links to posts are broken, and Apache (2.2.17) is responding with the following error: "The requested URL /sample-post/ was not found on this server."
I'm assuming I've missed a configuration step somewhere, though I've followed this process umpteen times in the past with no problems. The issue with this particular site is that the theme has been hacked with lots and lots of absolute paths entered, meaning setting up a dev site has required loads of code changes.
I'm not really sure how to further trouble shoot this, not completely understanding how Wordpress / Apache handles permalinks
Copy the .htaccess if you haven't already
I think that might be the problem
OK - sorted this, it was to do with mod_rewrite on apache.
To fix (this is for my install of Ubuntu 11.04):
first enable mod_rewrite in apache
sudo a2enmod rewrite
Then edit the relevant file in /etc/apache2/sites-available (could be 'default', or one specific to site):
sudo vi /etc/apache2/sites-available/site-file
Change AllowOverride directive for your site document root from None to All:
:
<Directory /var/www/site.com/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
That seems to have done it.