<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>rpaf &#8211; SMsoft &#8211; informatica e dintorni</title>
	<atom:link href="https://blog.smsoft.it/tag/rpaf/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.smsoft.it</link>
	<description>consigli settimanali su MacOS, GNU/Linux ed Open Source</description>
	<lastBuildDate>Wed, 23 Jun 2021 17:55:51 +0000</lastBuildDate>
	<language>it-IT</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=74511</generator>
	<item>
		<title>Apache: loggare il corretto IP se dietro proxy nginx</title>
		<link>https://blog.smsoft.it/2020/04/07/apache-loggare-il-corretto-ip-se-dietro-proxy-nginx/</link>
					<comments>https://blog.smsoft.it/2020/04/07/apache-loggare-il-corretto-ip-se-dietro-proxy-nginx/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 07 Apr 2020 08:30:00 +0000</pubDate>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[ip]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[rpaf]]></category>
		<guid isPermaLink="false">https://blog.smsoft.it/?p=4623</guid>

					<description><![CDATA[Ultimamente si usa spesso attivare nginx come proxy &#8220;davanti&#8221; ad Apache, magari per usare sistema di caching oppure per funzionalità particolari di bilanciamento, etc. Attivando semplicemente nginx come proxy, si vedrà che apache inizierà a loggare come IP visitatore sempre quello del proxy e non più quello del visitatore vero e proprio. Ipotizziamo di avere ... <a title="Apache: loggare il corretto IP se dietro proxy nginx" class="read-more" href="https://blog.smsoft.it/2020/04/07/apache-loggare-il-corretto-ip-se-dietro-proxy-nginx/" aria-label="Per saperne di più su Apache: loggare il corretto IP se dietro proxy nginx">Leggi tutto</a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Ultimamente si usa spesso attivare <strong>nginx</strong> come proxy &#8220;davanti&#8221; ad <strong>Apache</strong>, magari per usare <strong>sistema di caching</strong> oppure per funzionalità particolari di <strong>bilanciamento</strong>, etc.</p>



<p class="wp-block-paragraph">Attivando semplicemente nginx come proxy, si vedrà che apache inizierà a loggare come IP visitatore sempre quello del proxy e non più quello del visitatore vero e proprio.</p>



<p class="wp-block-paragraph">Ipotizziamo di avere sia nginx che apache sullo stesso nodo, praticamente nei logs di apache si vedrà sempre <strong>127.0.0.1</strong> come IP del visitatore.</p>



<p class="wp-block-paragraph">Per ovviare a questo, bastano due configurazioni. </p>



<h2 class="wp-block-heading"><strong>Su nginx:</strong></h2>



<p class="wp-block-paragraph">Modificare il file di configurazione del VirtualHost ed inserire nella sezione <strong>location</strong>:</p>



<pre class="wp-block-preformatted">proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;</pre>



<h2 class="wp-block-heading"><strong>Su apache &lt;2.4:</strong></h2>



<p class="wp-block-paragraph">Installare il modulo <strong>rpaf</strong>:</p>



<pre class="wp-block-preformatted">apt-get install libapache2-mod-rpaf</pre>



<p class="wp-block-paragraph">Poi modificare il file <strong>/etc/apache2/mods-enabled/rpaf.conf</strong> e modificare/inserire le direttive:</p>



<pre class="wp-block-preformatted">RPAFproxy_ips 127.0.0.1 ::1 
RPAFheader X-Forwarded-For</pre>



<h2 class="wp-block-heading"><strong>Su apache &gt;= 2.4:</strong></h2>



<p class="wp-block-paragraph">Creare il file <strong>/etc/apache2/mods-available/remoteip.conf</strong> con all&#8217;interno:</p>



<pre class="wp-block-preformatted">RemoteIPHeader X-Forwarded-For
RemoteIPInternalProxy 127.0.0.1</pre>



<p class="wp-block-paragraph">attiva il modulo remoteip:</p>



<pre class="wp-block-preformatted">a2enmod remoteip</pre>



<p class="wp-block-paragraph">Modificare le righe <strong>LogFormat</strong> nel file <strong>/etc/apache2/apache2.conf</strong> sostituendo <strong>%h</strong> con <strong>%a</strong>, es:</p>



<pre class="wp-block-preformatted">LogFormat "%v:%p %a %l %u %t \"%r\" %&gt;s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%a %l %u %t \"%r\" %&gt;s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%a %l %u %t \"%r\" %&gt;s %O" common</pre>



<p class="wp-block-paragraph">Ora riavviare apache ed nginx e nei files di logs ci saranno i corretti IP.</p>



<p class="wp-block-paragraph">enjoy!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.smsoft.it/2020/04/07/apache-loggare-il-corretto-ip-se-dietro-proxy-nginx/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Apache: loggare il corretto IP chiamante se ci troviamo dietro un proxy server</title>
		<link>https://blog.smsoft.it/2018/04/24/apache-loggare-il-corretto-ip-chiamante-se-ci-troviamo-dietro-un-proxy-server/</link>
					<comments>https://blog.smsoft.it/2018/04/24/apache-loggare-il-corretto-ip-chiamante-se-ci-troviamo-dietro-un-proxy-server/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 24 Apr 2018 08:30:26 +0000</pubDate>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[rpaf]]></category>
		<guid isPermaLink="false">https://blog.smsoft.it/?p=4025</guid>

					<description><![CDATA[A volte può essere utile usare un proxy server (per velocità, per bilanciare, etc) davanti al propio webserver, ma vi sarete accorti che nei files di log ci sarà sempre l&#8217;IP del proxy al posto di quello del visitatore reale. Per sopperire a questa mancanza, si può ricorrere al modulo rpaf, installabile tramite apt-get: apt-get ... <a title="Apache: loggare il corretto IP chiamante se ci troviamo dietro un proxy server" class="read-more" href="https://blog.smsoft.it/2018/04/24/apache-loggare-il-corretto-ip-chiamante-se-ci-troviamo-dietro-un-proxy-server/" aria-label="Per saperne di più su Apache: loggare il corretto IP chiamante se ci troviamo dietro un proxy server">Leggi tutto</a>]]></description>
										<content:encoded><![CDATA[<p>A volte può essere utile usare un proxy server (per velocità, per bilanciare, etc) davanti al propio webserver, ma vi sarete accorti che nei files di log ci sarà sempre l&#8217;IP del proxy al posto di quello del visitatore reale.<br />
Per sopperire a questa mancanza, si può ricorrere al modulo <strong>rpaf</strong>, installabile tramite apt-get:<br />
<code>apt-get install libapache2-mod-rpaf</code></p>
<p>Aprire infine il file di configurazione <strong>/etc/apache2/mods-enabled/rpaf.conf</strong> ed aggiungere l&#8217;IP del server proxy nella riga <strong>RPAFproxy_ips</strong>, es:<br />
<code> RPAFproxy_ips 127.0.0.1 ::1 10.109.70.60</code></p>
<p>e decommentare la direttiva:<br />
<code>RPAFheader X-Real-IP</code></p>
<p>Bene, riavviamo apache e ci siamo:<br />
<code>service apache2 restart</code></p>
<p>enjoy!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.smsoft.it/2018/04/24/apache-loggare-il-corretto-ip-chiamante-se-ci-troviamo-dietro-un-proxy-server/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
