Playgrounds
Snippets
Developers
Compiler
All
ActionScript
Ajax
AngularJS
Apache
AppleScript
ASP.NET
Bash
C
C#
C++
Coffee
CoffeeScript
ColdFusion
Command
CSS
Delphi
Django
ES6
GLSL
Grunt
Gulp
HAML
Haskell
HTML
iOS
Jade
Java
JavaScript
jQuery
JSX
Less
LUA
MDX
MySQL
Objective
Other
Pascal
Perl
PHP
Plain text
PowerShell
Processing
Progress
Prolog
Pseudocode
Python
Rails
RegExr
Ruby
SASS
Scala
Scheme
SCSS
SmallBASIC
Smarty
SQL
Stylus
SVG
Swift
TypeScript
VHDL
X++
XHTML
XML
Xojo
XSLT
New snippet
New playground
Sign up
Login
Upload
Playgrounds
Snippets
Developers
Sign up
Login
nginx: add new alias
Plain text
by
Marco Piñero
11th December 2016
1
2
#changes in /etc/nginx/sites-available/default
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
latest revision
2
1
Add alias into
2 Responses
#########Help with this Alias not working
#include /etc/nginx/conf.d/*.conf;
server {
listen 80;
listen 443 ssl;
server_name wall1.bhaskar.com;
ssl_certificate /etc/nginx/ssl/bundle.crt;
ssl_certificate_key /etc/nginx/ssl/bhaskar_com.key;
# include hhvm.conf;
root /disk4/wall1.bhaskar.com/public_html;
index index.html index.php;
access_log /var/log/nginx/wall1-access.log;
error_log /var/log/nginx/wall1-error.log;
if (!-e $request_filename){
# rewrite ^(.*)$ /index.php break;
rewrite ^/assets/js/v([0-9]+)/(.+)$ /assets/js/$2 last;
rewrite ^/images/thumbs(.*)$ /disk3/wallimages/thumbs/index.php?thumb=thumbs$1 last;
rewrite ^/images/testthumbs(.*)$ /disk3/wallimages/thumbs/demo.php?thumb=thumbs$1 last;
rewrite ^/(.*)$ /index.php/$1 last;
}
location /disk4/wall1.bhaskar.com/public_html {
try_files \$uri \$uri/ /index.php?\$query_string;
}
location /images {
alias /disk3/wallimages/images;
index index.php;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /disk4/wall1.bhaskar.com/public_html$fastcgi_script_name;
index index.php;
fastcgi_index index.php;
include fastcgi_params;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
# Deny .htaccess file access
location ~ /\.ht {
deny all;
}
}
0
Reply?
IMCL NOC
8 years ago
try this:
location ^~ /images {
alias /disk3/wallimages/images;
try_files $uri $uri/ =404;
}
0
Reply?
Marco Piñero
8 years ago
Write a comment
Send Comment
You can use [html][/html], [css][/css], [php][/php] and
more
to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.
2 Responses
#include /etc/nginx/conf.d/*.conf;
server {
listen 80;
listen 443 ssl;
server_name wall1.bhaskar.com;
ssl_certificate /etc/nginx/ssl/bundle.crt;
ssl_certificate_key /etc/nginx/ssl/bhaskar_com.key;
# include hhvm.conf;
root /disk4/wall1.bhaskar.com/public_html;
index index.html index.php;
access_log /var/log/nginx/wall1-access.log;
error_log /var/log/nginx/wall1-error.log;
if (!-e $request_filename){
# rewrite ^(.*)$ /index.php break;
rewrite ^/assets/js/v([0-9]+)/(.+)$ /assets/js/$2 last;
rewrite ^/images/thumbs(.*)$ /disk3/wallimages/thumbs/index.php?thumb=thumbs$1 last;
rewrite ^/images/testthumbs(.*)$ /disk3/wallimages/thumbs/demo.php?thumb=thumbs$1 last;
rewrite ^/(.*)$ /index.php/$1 last;
}
location /disk4/wall1.bhaskar.com/public_html {
try_files \$uri \$uri/ /index.php?\$query_string;
}
location /images {
alias /disk3/wallimages/images;
index index.php;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /disk4/wall1.bhaskar.com/public_html$fastcgi_script_name;
index index.php;
fastcgi_index index.php;
include fastcgi_params;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
# Deny .htaccess file access
location ~ /\.ht {
deny all;
}
}
location ^~ /images {
alias /disk3/wallimages/images;
try_files $uri $uri/ =404;
}
Write a comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.