twilio / OpenVBX

OpenVBX is a web-based open source phone system for business.
http://openvbx.org
Other
699 stars 342 forks source link

mod_rewrite #322

Closed kaburkett closed 9 years ago

kaburkett commented 9 years ago

I am trying to get OpenVBX and the iPhone/Android apps to work for our company. I read (on github) mod_rewrite needs to be enabled in order for the apps to work properly. So I modified the apache2.conf file:

<Directory />
    Options FollowSymLinks
    AllowOverride ALL
    Require all denied
</Directory>

<Directory /usr/share>
    AllowOverride ALL
    Require all granted
</Directory>

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride ALL
    Require all granted
</Directory>

#<Directory /srv/>
#   Options Indexes FollowSymLinks
#   AllowOverride ALL
#   Require all granted
#</Directory>

But when I do that, I get this message in my browser:

Not Found The requested URL /auth/login was not found on this server.

A previous issue was posted that had this same error and it was brought his attention that if you visit servername/index.php/auth/login the page pops and it did for me as well.

Before this stopped working, I enabled rewrite through the OpenVBX interface.. but didnt see that it made the change in the apache2.conf file so I made it manually.

Also, I checked for .htaccess file in html root dir and it wasn't there but I pulled it down and copied it there with the following contents:

<IfModule mod_alias.c>
    # by default disallow access to the base git folder
    RedirectMatch /\.git(/|$) /404
</IfModule>

# cache images for a while
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/css "access plus 1 month"
    ExpiresByType text/javascript "access plus 1 month"
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/jpg "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
</IfModule>

# compress output if we can
<IfModule mod_deflate.c>
    # Set output filter for zipping content
    SetOutputFilter DEFLATE
    # Netscape 4.x and 4.06-4.08 have issues
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    # MSIE can be an issue, for now catch all MSIE
    BrowserMatch \bMSIE[56] !no-gzip !gzip-only-text/html
    # Exclude file types from compression
    SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|pdf|zip|tar|rar|gz|dmg|mp3|mp4|m4a|m4p|mov|mpe?g|qt|swf)$ no-gzip dont-vary
    # Make sure proxy servers deliver what they're given
    <IfModule mod_headers.c>
        Header append Vary User-Agent env=!dont-vary
    </IfModule>
</IfModule>

<IfModule mod_rewrite.c>
    RewriteEngine ON

    # Set this if you have your installation in a subdirectory
    # RewriteBase /openvbx

    # By default always use SSL
    #RewriteCond %{HTTPS} !=on
    #RewriteRule ^(.*) https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule ^(.*) index.php?vbxsite=$1 [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L,QSA]
    #RewriteRule ^(.*) index.php/$1 [L,QSA]

    ErrorDocument 404 /fallback/rewrite.php
</IfModule>

After much stress of trying to figure out what the heck is wrong, I had recorded my changes and reverted back only to still be presented with the message and issue. Any insight or enlightenment will help me tremendously! My goal is to use OpenVBX and the app for iPhone and Android to make calls but it seems like no one is doing that.

kaburkett commented 9 years ago

Okay, so after a long session of complaining and head smacking I found what was causing an issue for me. It seems I did not run the apache command to enable rewrite... so for anyone else who has the problem make sure that both your conf file is set right and you run the command:

# a2enmod rewrite

and then

# service apache2 restart
kaburkett commented 9 years ago

This is the link I found for instruction: http://askubuntu.com/questions/48362/how-to-enable-mod-rewrite-in-apache