title: ISPConfig Vhost allowing clean URLs in Laravel
body: <p>I have an existing server which is working well hosting a number of sites using nginx and ISPconfig. However I have created a new site and wish to use Laravel.</p>
  
  <p>I've installed Laravel successfully via composer and have got as far as seeing the familiar welcome blade displayed when I visit mywebsite.com/public</p>
  
  <p>What I want to do next is make some clean urls. My experience with vhost files is somewhat limited and I'm having a bit of trouble with the config.</p>
  
  <p>My routes file looks like this</p>
  
  <pre><code>Route::get('/', function () {
      return view('welcome');
  });
  Route::get('/test', function () {
      return view('test');
  });
  </code></pre>
  
  <p>and I'd hoped to see mywebsite.com/test display the contents of test.blade.php</p>
  
  <p>I'm aware I need to do some work with the vhost file before I can expect this to work but my experience with vhosts is limited and I'm at a bit of a loss.</p>
  
  <p>My current file looks like this</p>
  
  <pre><code>server {
      listen *:80;
      server_name mywebsite.com ;
  
      root   /var/www/mywebsite.com/web;
  
      index index.html index.htm index.php index.cgi index.pl index.xhtml;
  
      error_page 400 /error/400.html;
      error_page 401 /error/401.html;
      error_page 403 /error/403.html;
      error_page 404 /error/404.html;
      error_page 405 /error/405.html;
      error_page 500 /error/500.html;
      error_page 502 /error/502.html;
      error_page 503 /error/503.html;
      recursive_error_pages on;
      location = /error/400.html {
  
          internal;
      }
      location = /error/401.html {
  
          internal;
      }
      location = /error/403.html {
  
          internal;
      }
      location = /error/404.html {
  
          internal;
      }
      location = /error/405.html {
  
          internal;
      }
      location = /error/500.html {
  
          internal;
      }
      location = /error/502.html {
  
          internal;
      }
      location = /error/503.html {
  
          internal;
      }
  
      error_log /var/log/ispconfig/httpd/mywebsite.com/error.log;
      access_log /var/log/ispconfig/httpd/mywebsite.com/access.log combined;
  
      location ~ /\. {
          deny all;
          access_log off;
          log_not_found off;
      }
  
      location = /favicon.ico {
          log_not_found off;
          access_log off;
      }
  
      location = /robots.txt {
          allow all;
          log_not_found off;
          access_log off;
      }
  
      location /stats/ {
  
          index index.html index.php;
          auth_basic "Members Only";
          auth_basic_user_file /var/www/clients/client1/web5/web/stats/.htpasswd_stats;
      }
  
      location ^~ /awstats-icon {
          alias /usr/share/awstats/icon;
      }
  
      location ~ \.php$ {
          try_files /5e26a1d85cb98f7191261e023385e60d.htm @php;
      }
  
      location @php {
          try_files $uri =404;
          include /etc/nginx/fastcgi_params;
          fastcgi_pass unix:/var/lib/php5-fpm/web5.sock;
          fastcgi_index index.php;
          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
          fastcgi_intercept_errors on;
      }
  }
  </code></pre>
  
  <p>Now on another server I have this working with this simple directive</p>
  
  <pre><code>server {
      root /var/www/public;
      index index.php index.html index.htm;
      server_name localhost;
  
      location / {
          try_files $uri $uri/ /index.php$is_args$args;
      }
  }
  </code></pre>
  
  <p>But I am limited to what I can do with the vhost on the current server as ISPconfig writes most of it for me and it refuses to write the above config that worked elsewhere. Also I feel editing the file directly will be bad practice, I'd always be on edge that ISPconfig will rewrite the file for me, so I'm not really sure how best to proceed with this.</p>
  
  <p>My options would be to just go ahead and edit the vhost and hope for the best, but if I do that how would I ensure ISPconfig could not overwrite the file without resorting to "hacky" methods?</p>
  
  <p>Alternatively, is there a config I can enter via ISPconfig that will allow rewrites to happen properly in a way that suits Laravel? In this instance, any directive entered would need to take precedence over the <strong>~ .php$</strong> clause as that is written by ISPconfig before any directives entered via the control panel.</p>