vi /etc/nginx/sites-available/default
server { server_name localhost; root /var/www; index index.php;
# serve static files
location ~ ^/(images|javascript|js|css|flash|media|static)/ {
root /var/www;
expires 30d;
}
location ~ \.php$ {
try_files $uri $uri/ /index.php?$args =404;
fastcgi_pass unix:/var/run/php5-fpm.socket;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
}
http://localhost/static/test.css or css/test.css
vi /var/www/composer.json { "require": { "slim/slim": "2.*", "hipchat/hipchat-php": ">=1.0.0" } }
php composer.phar update
vi /var/www/index.php <?php require 'vendor/autoload.php';
$app = new \Slim\Slim(); // $app = new \Slim\Slim( array( 'debug' => true ) );
$app->get( '/', function(){
echo "<html><body>";
echo dirname( __FILE__ ) . " <br />\n";
$token = 'your-token-here';
$hc = new HipChat\HipChat( $token );
echo $hc::DEFAULT_TARGET;
foreach( $hc->get_rooms() as $room ){
echo " - $room->room_id = $room->name\n";
}
echo "</body></html>";
} );
$app->run();
?>