Alessio Rocchi's Blog

Just another geek’s blog

Follow me on TwitterRSS Feeds

  • Home
  • About Me
  • Aforismi

Appunti Aapache2 mod_ssl Virtual Host e htaccess

Jul 15th

Posted by blackms in Howto's and Tips

No comments

Visto che a lavoro mi son trovato a dover scrivere 2 appunti su come ho configurato un server Apache, ho deciso di riportarlo anche sul mio blog, magari fa comodo a qualcuno :)

Apache2 + mod_ssl + htaccess + virtual hosts

Per aggiungere un nuovo virtual host basta fare i seguenti passi:
1 – Creare un file in /etc/apache2/site-available
2 – Popolarlo con la configurazione corretta sia sulla porta 80 che sulla 443 se necessario SSL
3 – Abilitarlo tramite il comando a2ensite [file di configurazione]
4 – Fare il reload di Apache2:

/etc/init.d/apache2 reload

Se non ci sono errori, il nuovo virtual host e` attivo.

Le configurazioni di Apache si trovano nella directory /etc/apache2, i virtual host creati risiedono in /etc/apache2/site-available e sono stati abilitati tramite in comando a2ensite

a2ensite wiki.trii.it

Di conseguenza sono attivi in /etc/apache2/site-enabled

Utilizziamo un sistema di accessi tramite htaccess che risiede in /var/www/wiki.trii.it/.htaccess, mentre il file dell pwd sta in /var/www/.htpasswd
Per aggiungere un utente basta utilizzare htpasswd nel seguente modo:

htpasswd /var/www/.htpasswd nuovoutente

Verra` chiesta due volte la password ed il gioco e` fatto.

La configurazione e` di tipo SSL, di seguito riportata

#Questo primo blocco server per fare redirect da http ad https nel caso in cui si tenti di accedere al wiki via http

<VirtualHost *:80>
ServerName wiki.trii.it
RedirectMatch (.*)$ https://wiki.trii.it$1
RedirectMatch /.* https://wiki.trii.it

</VirtualHost>

#Questo e` il blocco principale della configurazione, ho lasciato il blocco dei cgi-bin anche se in realta` non li usiamo.
<VirtualHost *:443>
SSLEngine on
SSLCertificateFile /etc/apache2/apache.pem
ServerAdmin alessio.rocchi@trii.it
ServerName wiki.trii.it
ServerAlias wiki

DocumentRoot /var/www/wiki.trii.it

Options FollowSymLinks
AllowOverride AuthConfig
Order allow,deny
allow from all

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,

# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined

</VirtualHost>

apache2, htaccess, mod_ssl, ssl, vhosts, virtual hosts

I’m your dream, make you real…

Jun 16th

Posted by blackms in Non Categorized

No comments

E` tutto il giorno che ascolto Sad but True dei Metallica… Mi sento in dovere di postare il video della canzone (ovviamente preso da YouTube).

Eccolo:

YouTube Preview Image

Mi piace molto per il ritmo insistente, un po` anche per la rabbia che esprime…

metallica

Stargate The best space battles remake HD

May 30th

Posted by blackms in TV Series

No comments

Just wonderful!

YouTube Preview Image
space battle, Stargate Universe

X-Chat Perl Reflex Script

May 11th

Posted by blackms in Perl

2 comments

Hi, this plugin allow your X-Chat client to reflex any DCC SEND like mIRC does. We have created this plugin, due to the high number of people that has requested us a plugin to reflex from X-Chat.
Also, my friend Xardax has the idea to make a plugin for KvIRC too, so be patient :)
If yuo have any doubts you can contact us on IRC: irc.darksin.ch :: #linux

#!/usr/bin/perl

use warnings;
use strict;
use Xchat;

my $reflex_nick="";

Xchat::register("Reflexer","1.0","Reflexer Perl Script","");
Xchat::print ("^BScript loaded.");
Xchat::print ("^BPlugin for X-Chat by blackms & Xardax :: #linux \@irc.darksin.ch");
Xchat::print ("^BUsage: /reflex REFLEX_NICK\n^BTo turn reflexing off: /rfx_off");

Xchat::hook_command('reflex',"reflex");
Xchat::hook_command('rfx_off',sub {
                                Xchat::print ("^BReflexing turned off.");
                                $reflex_nick="";
                              }
                   );
Xchat::hook_server("PRIVMSG","ctcpreflex");

sub reflex {
        $reflex_nick = defined $_[0][1] ? $_[0][1] : "";
        Xchat::print("^BReflexing all DCC SEND to: $reflex_nick");
        return Xchat::EAT_ALL;
}

sub ctcpreflex {
        return Xchat::EAT_NONE if ($reflex_nick eq "");
        my $data=$_[1][0];
        if ($data =~ m{\001DCC\sSEND\s(.*)\s(\d+)\s(\d+)\s(\d+)\001}) {
                my ($file,$intip,$port,$length) = ($1,$2,$3,$4);
                Xchat::print ("^BReflexing: $file to $reflex_nick on port: $port, length: $length");
                Xchat::command ("PRIVMSG $reflex_nick :\001DCC SEND $file $intip $port $length\001\n\r");
                return Xchat::EAT_ALL;
        }
        return Xchat::EAT_NONE;
}

Bye :)

dcc, dcc send, Perl, reflex, reflexer, X-Chat, xchat, xchat plugin perl

Simple Perl script to stress apache

Apr 19th

Posted by blackms in Perl

No comments

I’ve made this to stress this blog a little, and see how many requests could it handle.

#!/usr/bin/perl

use strict;
use LWP::Simple;
use LWP::UserAgent;
use Parallel::ForkManager;

my $pm = new Parallel::ForkManager(3);

for (1 .. 10_000) {
	my $pid = $pm->start and next;
	my $ua = new LWP::UserAgent;
	print "Request $_\n";
	$ua->timeout(120);
	my $url='http://www.rocchi.us/';
	my $request = new HTTP::Request('GET', $url);
	my $response = $ua->request($request);
	my $content = $response->content();
	#print $content;
	$pm->finish;
}

Bye

apache, Perl, stress
12345»...Last »
    • Recent comments
    • Popular posts
    • Archives
    • Tags
    • Categories
    • Daily News (13)
    • Education (2)
    • Howto's and Tips (7)
    • IRC's Logs (2)
    • Non Categorized (1)
    • Perl (3)
    • Projects (8)
    • Stargate Universe (2)
    • TV Series (2)
    alien aliens anti-ddos apache apache2 bash cern comics 2008 dcc dcc send ddos drupal esa experience gentoo iptables life linux mail mestery metallica Parallel Perl Perl Modules Petizioni physics quake reflex reflexer science script space space battle ssl starchild Stargate Universe strange things stress web webapp-config webgl works life X-Chat xchat xchat plugin perl
    • July 2010 (1)
    • June 2010 (1)
    • May 2010 (2)
    • April 2010 (5)
    • March 2010 (3)
    • February 2010 (2)
    • December 2009 (3)
    • November 2009 (2)
    • October 2009 (7)
    • September 2009 (1)
    • August 2009 (3)
    • July 2009 (2)
    • May 2009 (1)
    • April 2009 (1)
    • March 2009 (2)
    • December 2008 (1)
    • November 2008 (1)
    • October 2008 (2)
    • Export SSH Public Key (4)
    • Tips: rimuovo righe con # e righe vuote dai file (2)
    • X-Chat Perl Reflex Script (2)
    • Stargate Atlantis, la quinta stagione sara` la conclusiva. (0)
    • In una serata in chat… (0)
    • Lucca Comics 2008 (0)
    • Nuovo progetto, code-lab. (0)
    • Progetto Installazione IspCP parte prima (0)
    • Screenshots (0)
    • Serata su skype… Log divertenti! (0)
    • blackms: Grazie :) Speriamo che questa cosa sia utile eheh :)
    • antonio_: grandissimi :D
    • blackms: cat $nomefile |grep -v "^(#|$)" Questo e` errato in quanto grep non interpreta correttamente la...
    • Tobia: Fidarsi è bene, non fidarsi è meglio... gli ultimi due esempi non sono corretti perchè cosi i...
    • arressboW: Other variant is possible also
    • blackms: Creo il file nel caso non ci sia. A scanso di equivoci. Anche se come hai detto tu la redirection...
    • Danielino: Testina a che ti serve il touch ???
    • Danielino: Testina, a che ti serve il touch ???
  • Tags

    alien aliens anti-ddos apache apache2 bash cern comics 2008 dcc dcc send ddos drupal esa experience gentoo iptables life linux mail mestery metallica Parallel Perl Perl Modules Petizioni physics quake reflex reflexer science script space space battle ssl starchild Stargate Universe strange things stress web webapp-config webgl works life X-Chat xchat xchat plugin perl
  • Controls

    • Register
    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org
  • Search

  • Links

    • Alessandro's Blog
    • d35m0 Blog
    • Danielino's Blog
    • Dinghi's Blog
    • fvck3rcpu Blog
    • GroLUG
    • Luca's Blog
    • Marco's blog
    • Riccardo Tacconi Blog
  • Spam Blocked Stats

    1,687 spam comments blocked by
    Akismet
Mystique theme by digitalnature | Powered by WordPress
RSS Feeds XHTML 1.1 Top 1 visitors online now
1 guests, 0 bots, 0 members
Max visitors today: 7 at 09:11 am UTC
This month: 7 at 09-01-2010 10:36 pm UTC
This year: 12 at 08-20-2010 01:51 pm UTC
All time: 12 at 08-20-2010 01:51 pm UTC