Magento Config - Allow specific IP to Access a Route - apache

I know that using apache directives, one can deny / allow access to certain files based on IP address:
Allow from address
However, in Magento, there's a particular module / route where I'd like only one IP to have access. Is there a way to specify this int he configuration / xml for that module?
Otherwise, can I use the .htaccess method in some way?
Lastly, I'm using Puphpet / Vagrant environment for this project. Is it possible to specify this in the Puphpet config?

I ended up solving this by using the available bash script hooks. I created a bash script that added this specific directive to the nginx.conf, and placed it in puphpet/files/startup-always. So every time vagrant up or vagrant provision is run, this bash script is executed.

Related

Redirect Symfony URL

I have a Symfony3 installation on a server and I need to access the web files through the IP/game address.
So I created my "game" symfony folder with everything in it, and for now if I want to see my web content I need to add /web/app.php (or app_dev.php, nvm), which is logical.
So here is my question : How can I access my app.php (or app_dev.php) just by IP/game and not IP/game/web/app.php (or app_dev.php).
I can't configure any vhost to define a DocumentRoot so I think I have to use an htaccess but all my tests actually have failed :(
Thank you for your help and have a nice day !
The only way for this to work is always by accessing ( IP or hostname )/( app_dev.php for dev, nothing for prod )/routes
If you want to access dev environment you will need to use app_dev.php after hostname / IP. Everything after that is not related to file structure but with routing specified in configuration of Symfony application ( at least by default web server configuration which is provided on Symfony website ).

Trac on shared server

I'm facing an odd problem with Trac's authentication. I have it installed in other servers and never had problem to install it, but now I'm trying to install it on a shared linux server where:
don't have access to httpd.conf;
only available scripts are php and python (wsgi);
no dev tools at all (so no chance to use gcc to compile something);
.htaccess is okay.
Well, trac is installed and working in anonymous mode and I can not find a way to make it private. It looks like it only relies on Apache basic authentication but I can not do this without httpd.conf access.
On my other instalations I use <Location> inside httpd.conf, but I can't use this tag inside .htaccess. I know that I can simply put <Location>'s content inside a .htaccess file and put this file in any www subdirectory to protect it. But since this is a wsgi script in another directory outside www I have no place to put that .htaccess.
I'm looking for a way to solve this by:
still using apache auth with any other .htaccess configuration that I've missed;
any other way Trac could be used in privative besides relying on apache;
any other issue/project tracking similar to trac is an option too.
I'm using AccountManagerPlugin on a shared Linux server machine of mine without issues.

Trying to Properly configure the mod alias in Apache

I'm running apache 2.2.24 on Max OS X 10.9.1. Currently, we have a network drive that we access all of our Git repos on at /Volumes/GitWebsites. I would like to configure Apache to serve our PHP based repos from that directory. So, localhost (or 127.0.0.1)/phpsite1/ or /phpsite2? etc. will serve sites from /Volumes/GitWebsites/phpsite1/ or /phpsite2/ in the browser. My two questions are:
Do I simply modify the server root or do I need to use the mod-alias in the httpd.conf file?
What are the permission setting I need to in order for apache to access /Volumes/GitWebsites ?
I've done configuration changes like this in IIS 7.5 and set up a NodeJS dev environment but still new to make large scale changes to Apache. Thanks for any help given.
If you are happy with serving the contents of /Volumes/GitWebsites as it is then it should be fine to point the document root at it. It's also makes it easy to add sites later.
However this could be troublesome later if you want to manage php configuration later on for the sites separately.

Create Apache VitualHost for each User

I'm trying to setup a server at www.domain.com that will allow me to create hosting accounts for each user I add.
Basically my goal is to create a user and map a name-based vhost to their home dir, so:
"joe.domain.com" would point to "/home/joe"
I've tried setting up vhosts in httpd.conf but I'm not having any luck and wondering if there's a way to either 1. script this process or 2. setup some sort of variable in a generic vhost entry that will automatically create this entry.
Without knowing the details of your setup, I can tell you that:
Yes, you can script the process.
Apache configuration files are just text files, so it's very easy to generate the programatically.
Yes, you can configure some sort of generic virtual host entry.
The Dynamically configured mass virtual hosting documentation from Apache addresses this case quite nicely.

Configure Apache to use different Unix User Accounts (www-data) per Site

An Apache 2.x Webserver with default configurations from the ubuntu/debian repositories will use the www-data unix account for apache2 processes handling web requests. Assuming that apache is serving two different sites (domain1.com and domain2.com), is it possible for apache to use unix user www-data1 when handling requests to domain1.com, and use unix user www-data2 when handling requests to domain2.com? The motivation is to isolate the code for each domain name from one another.
Take a look at suEXEC.
suPHP is also a nice thing to look into:
"suPHP is a tool for executing PHP scripts with the permissions of their owners. It consists of an Apache module (mod_suphp) and a setuid root binary (suphp) that is called by the Apache module to change the uid of the process executing the PHP interpreter."
-http://www.suphp.org/
You can use apache2-mpm-itk to achieve this.
You will be able to run each vhost using group and user of your choice.
Check this article for details:
http://www.howtoforge.com/running-vhosts-under-separate-uids-gids-with-apache2-mpm-itk-on-ubuntu-9.04
I used this on my development machine (Ubuntu), If you're using for production please read this page carefully:
http://mpm-itk.sesse.net/