Skip to content

Instantly share code, notes, and snippets.

@waifung0207
Last active August 29, 2015 14:14
Show Gist options
  • Save waifung0207/837482a6f85096445230 to your computer and use it in GitHub Desktop.
Save waifung0207/837482a6f85096445230 to your computer and use it in GitHub Desktop.
Sample of Apache config vs Nginx config
<VirtualHost *:80>
DocumentRoot /var/www/dev
<Directory /var/www/dev>
Options -Indexes FollowSymLinks -MultiViews
AllowOverride All
Order allow,deny
allow from all
# URL rewrite
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</Directory>
LogLevel warn
ErrorLog /var/log/error.log
CustomLog /var/log/access.log combined
</VirtualHost>
server
{
listen 80;
access_log /var/log/access.log;
error_log /var/log/error.log;
root /var/www/dev;
index index.php;
# Prevents access to the app and vendor directories
location ~* ^/(application|system)
{
return 403;
}
# "URL rewrite"
location /
{
try_files $uri $uri/ /index.php?$query_string;
}
# Pass URIs ending in .php to the PHP interpreter
location ~* \.php$
{
try_files $uri =404;
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment