Last active
March 3, 2021 19:30
-
-
Save rturowicz/5231943 to your computer and use it in GitHub Desktop.
vhost - nginx (ZF)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# appserver | |
server { | |
listen 80; | |
server_name zftemplate.desktop; | |
access_log /var/log/nginx/zftemplate.desktop.access.log; | |
error_log /var/log/nginx/zftemplate.desktop.error.log; | |
root /home/user/WorkspacePHP/zftemplate/public; | |
rewrite ^/([0-9]*)/css/(.*) /css/$2; | |
rewrite ^/([0-9]*)/js/(.*) /js/$2; | |
rewrite ^/([0-9]*)/img/(.*) /img/$2; | |
location ~ ^.+\.(js|ico|gif|jpg|png|css)$ { | |
# root /home/user/WorkspacePHP/zftemplate/public; | |
access_log off; | |
} | |
location / { | |
index index.php; | |
} | |
# Deny access to sensitive files. | |
location ~ ^.+\.(ini|sql|htaccess)$ { | |
deny all; | |
} | |
# Rewrite rule adapted from zendapp/public/.htaccess | |
if (!-e $request_filename) { | |
rewrite ^.*$ /index.php last; | |
} | |
# PHP scripts will be forwarded to fastcgi processess. | |
location ~ \.php$ { | |
include fastcgi_params; | |
fastcgi_pass 127.0.0.1:9000; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME /home/user/WorkspacePHP/zftemplate/public/index.php; | |
} | |
} | |
# statics | |
server { | |
listen 80; | |
sendfile on; | |
tcp_nopush on; | |
tcp_nodelay on; | |
include mime.types; | |
default_type application/octet-stream; | |
log_format main '$remote_addr - $remote_user [$time_local] $status ' | |
'"$request" $body_bytes_sent "$http_referer" ' | |
'"$http_user_agent" "$http_x_forwarded_for"'; | |
server_name i.zftemplate.desktop; | |
access_log /var/log/nginx/i.zftemplate.desktop.access.log main; | |
rewrite ^/([0-9]*)/css/(.*) /css/$2; | |
rewrite ^/([0-9]*)/js/(.*) /js/$2; | |
rewrite ^/([0-9]*)/img/(.*) /img/$2; | |
# Deny access to sensitive files. | |
location ~ ^.+\.(php|ini|sql|htaccess)$ { | |
deny all; | |
} | |
location / { | |
root /home/user/WorkspacePHP/zftemplate/public; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment