I'm looking looking for solving my problem, but still I cannot solve it...
I have a firewall (pfsense) in a cloud VM on which I have a reverse proxy (HAproxy) for balancing and offload https on 2 backend servers.
These 2 servers are classic LAMP (Ubuntu Apache2 2.4.53, PHP 7.4, MySQL)
I 'm using phpmyadmin on a different port (let's say 1234), and I'm using the same domain (example.com) on the reverse proxy which balance to lamp1 or lamp2 depend which address :
example.com:1234/phpmyadmin1 => LAMP1
example.com:1234/phpmyadmin2 => LAMP2
All of that works nice, but as I'm still learning, I made mistakes that I realized after few months. I could use php-fpm instead php-mod, I would like to use php8.1 and php7.4 and big mistake my Ubuntu version was 21.04 (yes I stupidly mistake with the LTS...)
So for doing all of that, I finally decide to start a fresh install on a new VM : LAMP3
I have my new LAMP3 with phpmyadmin, I followed DigitalOcean tuto for PHP-FPM, tested with simple web page, I can switch to php8.1 or php7.4. Everything sounds good.
Now I would like to integrate the LAMP3 in the reverse proxy in order to redirect example.com:1234/phpmyadmin3 to my phpmyadmin
When I'm on the VPN I can try http://10.0.0.3:1234/phpmyadmin3 and it works.
But when I try from internet with https://example.com:1234/phpmyadmin3 , I have on error 404 Not Found .
This error 404 mean I'm on the server and not on the reverse proxy. so I'm redirected to the right place.
I changed the config for using original alias (/phpmyadmin) and update it on the reverse proxy. Guess what, it's working ! And I'm sure it's LAMP3 because I have php8.1 for phpmyadmin (that I don't on the 2 others LAMP)
I tried with include the default phpmyamin in the virtualhost, but I prefer having all in 1 place so I made a virtualhost phpmyadmin.conf with all info (see below)
I disable phpmyadmin in apache conf (a2disconf phpmyadmin)
I tried a lot of different things into this virtualhost that now I'm getting lost
I reapeat again, but when I change the alias from /phpmyadmin3 to /phpmyadmin everything works as it should.
So why, where how to solve that ?
What's wrong with my alias ?
phpmyadmin.conf
<VirtualHost *:17380>
ServerName localhost
Alias /phpmyadmin3 /usr/share/phpmyadmin
DocumentRoot /usr/share/phpmyadmin
DirectoryIndex index.php
<Directory /usr/share/phpmyadmin>
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
Require all granted
</Directory>
<Directory /usr/share/phpmyadmin/templates>
Require all denied
</Directory>
<Directory /usr/share/phpmyadmin/libraries>
Require all denied
</Directory>
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php/php8.1-fpm.sock|fcgi://localhost"
</FilesMatch>
ErrorLog ${APACHE_LOG_DIR}/phpmyadmin.error.log
CustomLog ${APACHE_LOG_DIR}/phpmyadmin.access.log combined
</VirtualHost>
VirtualHost *:17380>
ServerName example.com
Alias /phpmyadmin3 /usr/share/phpmyadmin
DocumentRoot /usr/share/phpmyadmin
DirectoryIndex index.php
<Directory /usr/share/phpmyadmin>
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
Require all granted
</Directory>
<Directory /usr/share/phpmyadmin/templates>
Require all denied
</Directory>
<Directory /usr/share/phpmyadmin/libraries>
Require all denied
</Directory>
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php/php8.1-fpm.sock|fcgi://localhost"
</FilesMatch>
ErrorLog ${APACHE_LOG_DIR}/phpmyadmin.error.log
CustomLog ${APACHE_LOG_DIR}/phpmyadmin.access.log combined
</VirtualHost>
Versions
Ubuntu 22.04
apache 2.4.53
mysql 5.7.38
php-fpm7.4
php-fpm8.1
I kind if solve my problem...
Instead of using the alias /phpmyadmin3 , I tried with alias /pma3 and /test
And it works !
Soooo... I guess it's something with cache on my server ?
Not with my browser as I tried from different PC with different browser in private mode.
Solve I guess
Related
I have 2 different virtual hosts on my apache server. One of them needs php7.x and another need php5.x.
Is it possible to use project-specific PHP versions?
I have tried the following,
Running two PHP versions on the same server
but my apache server crashed saying there's some syntactical error in one of the fpm's config file.
Also I cant follow this solution since It advices to uninstall apache and start over again and I can't do that on a live server.
Is there any way to do this without uninstalling the apache server.
Thank you for your suggestions.
for windows on file httpd-vhosta.conf
<VirtualHost *:80>
DocumentRoot "d:/server/htdocs/"
ServerName localhost
ServerAlias www.localhost
<Directory "d:/server/htdocs/">
Require all granted
<Files ~ "\.php$">
AddHandler fcgid-script .php
#FcgidWrapper "d:/server/php/php-5.6.40-Win32-VC11-x64/php-cgi.exe" .php
FcgidWrapper "d:/server/php/php-7.1.24-Win32-VC14-x64/php-cgi.exe" .php
Options +ExecCGI
</Files>
</Directory>
ErrorLog "D:/server/apache/logs/error-localhost.log"
SetEnv APP_ON_LOCAL 1
</VirtualHost>
I have a Mac OSX El Capitan operating system. Since my laptop has limited space, I am trying to set up a local server on my 1TB external hard drive with the url http://media.database/, and that uses PHP. I have set it up the best I know how, but when I go to the page, it says "Forbidden You don't have permission to access /index.php on this server."
I have set apache and host files as best I know how, but I'm still pretty new to this sort of thing. I have listed my updates to those files below and restarted the apache server using sudo apachectl restart, which has gotten me this far. Can someone enlighten me on what I might be missing. All help is greatly appreciated.
/etc/apache2/httpd.conf
<VirtualHost *:80>
ServerName media.database
DocumentRoot "file:///Volumes/DBTARA/media/"
<Directory "file:///Volumes/DBTARA/media/">
DirectoryIndex index.php index.html
AllowOverride all
Options -MultiViews
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
/etc/hosts
127.0.0.1 media.database
/etc/apache2/users/vmbmacintosh.conf
<Directory "file:///Volumes/DBTARA/media/">
AllowOverride All
Options Indexes MultiViews FollowSymLinks
Require all granted
</Directory>
/etc/apache2/httpd.conf
I attempted to add the following DocumentRoot after the one I already have, but that made my other local servers inaccessible and kept the external one as forbidden.:
DocumentRoot "file:///Volumes/DBTARA/media"
<Directory "file:///Volumes/DBTARA/media">
Options FollowSymLinks Multiviews
MultiviewsMatch Any
AllowOverride None
Require all granted
</Directory>
Thanks again in advance for any assistance.
I know this question has been asked a lot of times
I followed Most of the answers in the internet But I still get the same Message
403 Forbidden
You don't have permission to access / on this server.
It is weird that when I access using the same PC to localhost:1234 it runs normally but if I access using my IP address 192.168.0.188:1234
Also which is really weird is that I tried to install WAMP on other PC and without any configuration I could access to that PC.
So I thought it's because McAfee and Firewall so I open port on Widows and McAfee and nothing changed also I turned off Firewall and still nothing change.
Then for no reason I opened port through the Router “port forwarding” and still nothing changed.
I don't think that it's because my configuration in WAMP since I am still able to get this 403 Forbidden Message and also by using other PC without any configuration I could access it.
Both PCs are setup like this:
Windows 8 Pro
WAMP Wampserver: 2.4
Apache Version: 2.4.4
PHP Version: 5.4.12
MySQL Version: 5.6.12
The accessible PC uses Microsoft Security Essentials.
The inaccessible PC uses McAfee Internet Security.
I tried to turn off WAMP and start IIS For Microsoft Server (I works perfectly From any PC) but WAMP is still not not working
I followed these tutorial:
How to Access WAMP Server in LAN or WAN
Install & Setup Virtual Host Guide for WAMP
Install & Setup LAN & Worldwide Access Guide for WAMP
And the Stack Overflow answers here:
Cannot access wamp server on local network
WAMP 403 Forbidden message on Windows 7
If you are using WAMPServer 3 See bottom of answer
For WAMPServer versions <= 2.5
By default Wampserver comes configured as securely as it can, so Apache is set to only allow access from the machine running wamp. Afterall it is supposed to be a development server and not a live server.
Also there was a little error released with WAMPServer 2.4 where it used the old Apache 2.2 syntax instead of the new Apache 2.4 syntax for access rights.
You need to change the security setting on Apache to allow access from anywhere else, so edit your httpd.conf file.
Change this section from :
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from ::1
Allow from localhost
To :
# onlineoffline tag - don't remove
Require local
Require ip 192.168.0
The Require local allows access from these ip's 127.0.0.1 & localhost & ::1.
The statement Require ip 192.168.0 will allow you to access the Apache server from any ip on your internal network. Also it will allow access using the server mechines actual ip address from the server machine, as you are trying to do.
WAMPServer 3 has a different method
In version 3 and > of WAMPServer there is a Virtual Hosts pre defined for localhost so you have to make the access privilage amendements in the Virtual Host definition config file
First dont amend the httpd.conf file at all, leave it as you found it.
Using the menus, edit the httpd-vhosts.conf file.
It should look like this :
<VirtualHost *:80>
ServerName localhost
DocumentRoot D:/wamp/www
<Directory "D:/wamp/www/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
Amend it to
<VirtualHost *:80>
ServerName localhost
DocumentRoot D:/wamp/www
<Directory "D:/wamp/www/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Hopefully you will have created a Virtual Host for your project and not be using the wamp\www folder for your site. In that case leave the localhost definition alone and make the change only to your Virtual Host.
Dont forget to restart Apache after making this change
For Apache 2.4.9
in addition, look at the httpd-vhosts.conf file in C:\wamp\bin\apache\apache2.4.9\conf\extra
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot C:/wamp/www
<Directory "C:/wamp/www/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require local
</Directory>
</VirtualHost>
Change to:
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot C:/wamp/www
<Directory "C:/wamp/www/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require all granted
</Directory>
</VirtualHost>
changing from "Require local" to "Require all granted" solved the error 403 in my local network
I got this answer from here. and its works for me
Require local
Change to
Require all granted
Order Deny,Allow
Allow from all
To expand on RiggsFolly’s answer—or for anyone who is facing the same issue but is using Apache 2.2 or below—this format should work well:
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 ::1
Allow from localhost
Allow from 192.168
Allow from 10
Satisfy Any
For more details on the format changes for Apache 2.4, the official Upgrading to 2.2 from 2.4 page is pretty clear & concise. Key point being:
The old access control idioms should be replaced by the new
authentication mechanisms, although for compatibility with old
configurations, the new module mod_access_compat is provided.
Which means, system admins around the world don’t necessarily have to panic about changing Apache 2.2 configs to be 2.4 compliant just yet.
For those who may be running WAMP 3.1.4 with Apache 2.4.35 on Windows 10 (64-bit)
If you're having issues with external devices connecting to your localhost, and receiving a 403 Forbidden error, it may be an issue with your httpd.conf and the httpd-vhosts.conf files and the "Require local" line they both have within them.
[Before] httpd-vhosts.conf
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local <--- This is the offending line.
</Directory>
</VirtualHost>
[After] httpd-vhosts.conf
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
</Directory>
</VirtualHost>
Additionally, you'll need to update your httpd.conf file as follows:
[Before] httpd.conf
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
# onlineoffline tag - don't remove
Require local #<--- This is the offending line.
</Directory>
[After] httpd.conf
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
# onlineoffline tag - don't remove
# Require local
</Directory>
Make sure to restart your WAMP server via (System tray at bottom-right of screen --> left-click WAMP icon --> "Restart all Services").
Then refresh your machine's browser on localhost to ensure you've still got proper connectivity there, and then refresh your other external devices that you were previously attempting to connect.
Disclaimer: If you're in a corporate setting, this is untested from a security perspective; please ensure you're keenly aware of your local development environment's access protocols before implementing any sweeping changes.
I have a VPS server from digitalocean. It is running on ubuntu 13.10 64 bit o with apache 2.4, PHP 5 and mysql 5.5
I've installed phpmyadmin. I want to access it through only ip address. I mean 12.34.56.789/pma
but the thing is that I've set up two virtual hosts domain and www.domain so if I go to domain/pma and www.domain/pma it allows me to access phpmyadmin which I don't want to allow. So any suggestion friends? Here is my /etc/phpmyadmin/apache.conf file's codes.
# phpMyAdmin default Apache configuration
Alias /pma /usr/share/phpmyadmin
<Directory /usr/share/phpmyadmin>
Options FollowSymLinks
DirectoryIndex index.php
AllowOverride All
So how to allow access to phpmyadmin from only ip address?
Create a default Virtual Host directive. You can follow this link : setting a default apache virtual host
Put your alias /pma into the default virtual host. It might look like:
<VirtualHost *:80>
DocumentRoot /var/www
<Directory /var/www >
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Alias /pma /usr/share/phpmyadmin
<Directory /usr/share/phpmyadmin>
Options FollowSymLinks
DirectoryIndex index.php
AllowOverride All
</Directory>
</VirtualHost>
Now I've searched and played around cannot get my head around what is going on.
I am unable to install a local webserver (XAMPP or w/e) onto this laptop, so I am hoping to have a play with Laravel 4 directly on my dedicated box.
I have a Linux box (Debian) with Apache, Composer and PHP 5.4.4 installed. Plenty of other websites up and running on this.
I have installed Laravel 4, via Composer directly into a directory: public_html/dev/
Apache is set-up so the sub-domain dev.mydomain.com points to this directory.
Going to dev.mydomain.com, or dev.mydomain.com/public/ (anything in-fact) gives me a 403 Forbidden error.
My apache config file:
<VirtualHost (my ip)>
ServerAdmin webmaster#localhost
ServerName dev.mydomain.com
DocumentRoot /home/user/public_html/dev
Options -Indexes -FollowSymLinks -MultiViews
</VirtualHost>
I've tried chmod 777 to public, the document root to /home/user/public_html/dev/public but with no luck.
Unless I'm missing the point of something here, or some security problem (since working on a live server isn't great) then please tell me, I'm probably being a noob.
Try this
<VirtualHost *:80>
DocumentRoot /home/user/public_html/dev/public
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/user/public_html/dev/public/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
You had -FollowSymLinks, and i assume this applies to also the rewrite rule that comes default with laravel. (.htaccess file) removing the -Follosymlinks would have fixed it for you too i presume.