Kill a hung EventMachine WebSockets server

Sometimes (very often) when I restart Apache, my Rails application running in Passenger fails to open port for Web Sockets server running on top of EventMachine: ... port is in use or requires root privileges

It proves that old Web Sockets server hung while doing service httpd stop and is taking the port.

How to make sure that on stopping Apache all the resources are freed? {
   EventMachine::WebSocket.start(:host => '', :port => EnvParams.web_sockets.port) do |ws|

Apache ignores Document root

I have the following VirtualHost file:

 <VirtualHost *:80>


        ServerAdmin [email protected]
        DocumentRoot /var/www/html/xxx/public

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined


Apache seems to ignore my Document Root and shows me instead a file which is located in the


directory. Is there anything I need to change in order to get this running?

Migration to liveserver laravel shows first page but no route is working (except /)

So I've just moved a laravel project from localhost to a live server and I can open the page if I type the address. DB connection works, everything else is fine. Only thing that doesn't work are all of my routes except for the first page.

I've tried a couple of things, such as changing this line:

'url' => 'http://localhost', 

to my pages address, have tried the both different .htaccess files laravel provides... Nothing seems to help.

I'm using apache 2.4.10, php 5.6.2 on ubuntu 14.04 LTS, no C-panel, no Plesk.

Can someone tell me what I've been missing. Thanks!

Point subdomain to Port [on hold]

What i want is for to show the contents of

I have a script that runs on port 7777 that i would lke the world to access. I know about vhost and whatnot but cannot get subdomain to point to correct port.

I have tried the following.

< VirtualHost *:80>
ProxyPass /
ProxyPassReverse /

What am i missing here?

Also tried this:

<VirtualHost *:80>
redirect /
< /VirtualHost>

Internal Server Error While Uploading Files

I'm working on a yelp-like listings website where a provider can upload his company logo amongst other details. This works brilliantly on my local system, but when i put it on apache passenger, it shows an internal server error.

Here are the givens that i've found:

  • params are working fine and have been passed successfully
  • File.* are working fine
  • No db/activerecord issues
  • FileUtils.copy and FileUtils.mkdir_p seems to be the issue

I'm guessing that this is a permissions issue? if so, how do i go about rectifying it?

Here is the code:

    include FileUtils::Verbose
    set :public_folder, File.join(File.dirname(__FILE__), 'public')
    set :files, File.join(settings.public_folder, "images/#{'%Y')}/#{'%m')}")

    if params[:file][:filename] && params[:file][:tempfile]
        filename = "#{params[:company_name]}_" + params[:file][:filename]
        file = params[:file][:tempfile]

            copy(file.path, File.join(settings.files, filename))
            copy(file.path, File.join(settings.files, filename))
        file_path = "/images/#{'%Y')}/#{'%m')}/#{filename}"
        provider.update_attribute("file_name", file_path)

RewriteRule Needed

i recently built my own web page. Now i want to use RewriteRules to be able to e.g. call "" and let the server display "". In the future there will be alot more pages, so a dynamic rule is needed.

The server structure looks like this:

  • css
    • core.css
  • image
    • header.png
    • navbar.jpg
  • page
    • events.php
    • home.php
    • index.php
  • .htaccess

My .htaccess file looks like this by now:

<IfModule mo_rewrite.c>
  RewriteEngine on
  RewriteBase /
  RewriteRule ^(.*)$ page/index.php?task=$1 [L]

I hope you can help me! Thank you

RegEx to remove part of a file name

To help control caching on our site I'm looking to name some of the resource files (css & js) with a version number in their url (eg. site.v104.css) which will allow us to push updates through to users when we want, but to reduce maintenance and renaming the actual file each time I want to setup a .htaccess rule which will automatically rewrite these urls from the browser and present the content from its actual location.

If the file is in the css folder and ends with .vNNN.css then I want to server up the content from .vNNN, so for example if the file in the HTML of the site is: "site_media/css/site.v104.css" then I want it to load the content from "site_media/css/site.css" and the below rule works for this.

In my .htaccess file I have added the following line:

RewriteRule ^(site_media/css/.*).v\d+(\.css)        /$1$2           [U,L]

However if I have a file with multiple '.' (eg. "site_media/css/") then it doesn't work it returns "site_media/css/site.css" instead of "site_media/css/".

I could live without checking that the file is in the correct folder but I want to be safe and control exactly which ones it replaces.