Allow request coming from specific IP only [closed] - apache

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have application hosted Apache UNIX, and I am allowing users to access the application url from citrix environment (from citrix machine).
However, currently its possible to access the url from all the connected machines. I would like to put the restriction that it should be only accessed from citrix machine. So if any one needs to access it, he needs access to citrix machine.
I tried with below:
<Directory /APP>
Order Deny,Allow
Deny from all
Allow from 160.120.25.65
Allow from 127
</Directory>
it didn't work. Any suggestion?
Few replied with iptables solution, however this one loaded on Solaris (it doesn't have builtin firewall to OS as linux).

This should do what you need:
<Directory /APP>
Order Allow,Deny
Allow from 160.120.25.65
Allow from 127.0.0.0/8
</Directory>
See the mod_authz_host documentation for details.

What version of Apache are you running? The IP allowing mechanisms are, AFAIK, provided by mod_authz_host, which was introduced in 2.2 (well, 2.1 technically). If you do have 2.2, make sure it wasn't compiled with mod_authz_host disabled.
Generally speaking, though, you may find a simpler and more robust solution is the iptables or other firewalling suggested in the other answers.

I would suggest Iptables for this purpose. put a rule in the iptables that wherever the destination port is the port number of your apache machine and the source ip is the ip address of critix machine, the linux machine should drop that packet. This way would solve your problem provided there are no other applications hosted on the apache of your machine which ought to be open for all ips. An example of the perspective rule could be :-
iptables -I INPUT 1 -s 160.120.25.65 -d <port_of_apache_on_your_machine> -j DROP
This should solve your problem, once you replace by its proper value

I would probably use an iptables rule for this. I'm not sure what the example you posted is, but you should be able to configure just about any firewall to work like you want it.

Related

Same domain - 2 separate servers [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
I have a website that runs on a framework on a LAMP stack.
Now I want to extend this website by adding a bunch of new pages, but served from a different framework on a separate LAMP stack on another server that is prepared to handle more traffic.
I don't want this traffic to pass by the original website as it will be a burden to be processed by the framework. However, I can afford to have apache forwarding the traffic request to a specific folder forwarded to a separate server with a different IP address.
For example:
mydomain.com/ -> goes to server A,
mydomain.com/folder1/ -> goes to server B
How can I accomplish this with apache?
I can even afford setup a separated server to handle the separation of these request, so each server will only receive the requests it is intended to process.
Another option could be to set a subdomain like ww2.mydomain.com pointed to the IP of a separated server but will this affect my SEO ranking?
What are other options and what would be the best option for this case?
You are looking for ProxyPass directive.
Example location for mydomain.com virtualhost:
<VirtualHost ...>
ServerName mydomain.com
...
<Location /folder1/>
ProxyPass http://serverb/
SetEnv force-proxy-request-1.0 1
SetEnv proxy-nokeepalive 1
</Location>
</Virtualhost>

Wamp: Phpmyadmin shows blank page, localhost page is working [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have installed Wamp on my computer (Win 8).
Since I had IIS installed also I changed the ports to 8080 instead in apache -> httpd.conf. Both on Listen and on ServerName. And I unchecked the IIS thing in Windows programs. (Sorry don't know what it's called my OS is in Swedish).
My hosts file only has: 127.0.0.1 localhost.
When I did that I got the localhost:8080 to work.
But when I try to access phpmyadmin it just shows a blank page. I have also tried opening Wamp as an administrator. And I have re-installed Wamp multiple times.
Now I need some help, feel like I am running out of options. I am a newbie so please don't make it complicated =) Thanks!
Try launching phpMyAdmin using
http://localhost:8080/phpmyadmin
If that works then its an IPV4/IPV6 confusion, Apache now listens to both ip address ranges by default and browsers tend to pick either IPV4 or IPV6 addresses for no apparent reasons. Add this line to your HOSTS file to associate localhost with the IPV6 loopback address
::1 localhost
Also check the phpMyAdmin config security, edit ?\wamp\alias\phpmyadmin.conf
If you are using Apache 2.2.x, change the Allow it to look like this
<Directory "c:/wamp/apps/phpmyadmin3.5.1/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 localhost ::1
</Directory>
If you are using Apache 2.4.x, change the whole Directory section to look like this
<Directory "d:/wamp/apps/phpmyadmin4.0.4/">
Options Indexes FollowSymLinks ExecCGI
AllowOverride all
Require local
</Directory>
If you are using sqlbuddy or webgrind their config files also need changing in the same way in ?:\wamp\alias\...
For me it has some problems with sessions... so first, try to login with another browser like Firefox or something else and if it works in that browser you have to clear your browser cache ...
simply use Ctrl+F5 for example 3 times or clear all cookies from your browser settings...
This happened to me and I fixed it by quitting Skype (I guess it was a port collision) and then stopping all services then turning them back on.
I ended up with installing XAMPP and found out that it was a problem with port 443. Then I just opened XAMPP as administrator and it magically worked! =)
I realize that this is an old question, but I came across a situation that wasn't covered by the above solutions, so I'll put it here for posterity:
If you're using phpMyAdmin < 4.2.12, make sure your browser is allowing JavaScript on localhost.
PhpMyAdmin is heavily dependent on JavaScript, and although there is a <noscript> tag in the DOM, some versions (like 4.1.2) have a CSS declaration that says:
html {
display: none;
}
It then uses JavaScript to make it visible after the page loads, for cross-framing protection. As a result, the user can't see the <noscript> section telling them to turn on JavaScript, or the rest of the page for that matter.
This issue is fairly version-specific, as it seems to have been introduced in 4.x and fixed in 4.2.12 (see related bug report). So if you come across this issue, after you enable JavaScript, try upgrading to a newer version of phpMyAdmin.
Personally my issue was with the php.ini file. After looking through the error log some of the values I put in were incorrect. By resetting them in the php.ini this allowed phpmyadmin to load properly.
The solution to this blank page problem is fairly easy. Simply modify this line in the PHPMyAdmin/config.inc.php
$cfg['Servers'][$i]['host'] = 'localhost';
to this:
$cfg['Servers'][$i]['host'] = '127.0.0.1';
In the above code, you’re changing your name server to 127.0.0.1 in order to use TCP/IP connection. After this, you should be able to see your PhpMyAdmin page by opening in your browser the address http://127.0.0.1/PhpMyAdmin
For more solutions .. >
http://www.karinamyers.com/howto-fix-phpmyadmin-displays-blank-page-after-logging-inhowto-fix-phpmyadmin-muestra-pagina-en-blanco-despues-de-logeo/
JUST change the port to 81, that worked for me . the was a conflict on port 80 with microsft.
Its simple solution change memory_limit to -1, i.e memory_limit = -1 in php.ini file and restart the wamp.
This works
Some may change the memory limit by reading what is written above it in the php.ini file.
; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit = 128M
They may change the 128M to 128MB if tinkering. It's best you enter the right credentials because the slightest mistake could have you scratching your head for hours. If you don't know.. don't change anything and seek help or best, if you don't know, you shouldn't be changing anything at all.
This has nothing to do with ports.. however, it has to do with the blank page under phpmyadmin log in and it may help someone that visits this thread.
Memory limit, post_max_size and upload_max_filesize are some of the most changed lines in an ini file and should really be separated out in a future host releases because as said above a slight change or an accidental removal of any text in there can bring your whole site crashing down.
Regarding Ports..I work with Wampserver and its a common problem that anti virus apps installed within Windows take up the same ports. Disabling these if not needed is and option but (NOT recommended). You can however change the ports that wampserver points to in your config.

Trying to enable https on apache server in Ubuntu 12.04 [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I've got an installation of the apache2 package on Ubuntu 12.04, and I've installed the PHP mod so that I can run PHP scripts on my server. I'm now trying to set up the server for HTTPS. The application I'm working on needs to have https access enabled, but I've never had much experience with SSL, certs, or any of that security stuff (I'm trying to learn, however).
I've tried following tutorials online, but there always seems to be a failure with each tutorial. Here's my most recent attempt:
sudo make-ssl-cert generate-default-snakeoil --force-overwrite
sudo a2enmod ssl
sudo a2ensite default-ssl
sudo /etc/init.d/apache2 restart
This series of commands doesn't output any errors, but when I navigate to https://, it tells me the webpage is not available. Navigating to http:// works fine.
Am I missing something, or has this tutorial just led me astray? I'd really like to figure out how to enable Apache on Ubuntu 12.04 to handle https requests. :)

Pound & Apache: REMOTE_HOST contains host of proxy [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I have a server running Ubuntu 12.04 LTS, Pound 2.6 and Apache 2.2. I have also the apache module mod_rpaf (installed from https://github.com/gnif/mod_rpaf) installed and enabled to ensure, that in the variable REMOTE_ADDR appears the real user ip address and not the address of the proxy.
This works fine, but the variable REMOTE_HOST is not changed by mod_rpaf. This variable contains "localhost" and not the host of the given user ip address.
Can you help me, please?
Here is my mod_rpaf configuration:
root#perseus ~ # cat /etc/apache2/mods-enabled/rpaf.conf
RPAF_Enable On
RPAF_ProxyIPs 127.0.0.1
RPAF_Header X-Forwarded-For
RPAF_SetHostName On
RPAF_SetHTTPS On
RPAF_SetPort On
Thank you
Check theses answers on a previous question about a missing REMOTE_HOST:
REMOTE_HOSTS is a variable that may or may not be populated by apache (and it's better if it is not set, else it imply a DNS query by apache for every incoming request). So Nothing on your code should rely on REMOTE_HOST. No application should assume this variable will be there and correctly filled.
mod_rpaf does what it is designed for, documentation:
Sets REMOTE_ADDR, HTTPS, and HTTP_PORT to the values provided by an upstream proxy.
Now you have a working REMOTE_ADDR, which is the only variable you should trust, make a copy of it in REMOTE_HOST if you really wants that, and simply do it in your application code.
There is a bug in Ubuntu LTS 12.04 that prevents rpaf to work at all.
https://bugs.launchpad.net/ubuntu/+source/libapache2-mod-rpaf/+bug/1002571
workaround
in rpaf.conf replace
<IfModule mod_rpaf.c>
by
<IfModule mod_rpaf-2.0.c>

How to set mod_proxy to serve some files while others to be served by apache [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have enabled mod proxy to serve my jsp and servlets and it seem to work fine. So if i hit localhost, it takes request to tomcat and executes it. What is want is that servlets and jsp are forwarded to tomcat while php is handled by apache. Both JSP/Servlets and PHP files are in the same folder and I need to make a call from JSP?Servlet to PHP or may be vice versa as well. Now the problem is that PHP is also forwarded to tomcat it seems if I use following pattern -
ProxyPass /auto http://serv.corp.com:8080/auto/
All JSP/Servlets and PHP files are inside auto folder which is in webapps folder.
Kindly help me to route static content i.e. PHP to apache.
To server static content by Apache and remain files by appserver (jboss in my case)..
httpd.conf of Apache should look as:--
DocumentRoot /usr/local/apache2/htdocs
ProxyPass / !
ProxyPass / https://www.example.com:8443/
ProxyPassReverse / https://www.example.com:8443/
here for example /logo.gif will be served directly by
Apache from the /usr/local/apache2/htdocs/logo.gif file.
And everything else will be served by appserver.
Hope it will be useful
You want to use ProxyPassMatch rather than ProxyPass. Something like (untested)
ProxyPassMatch ^/(.*\.php)$ !