vendredi 28 novembre 2014

2 subdomains on same nginx server


Vote count:

0




I'm trying to install Roundcube and VimBAdmin on the same Nginx server.


I have created 2 sub-domains pointing on the same IP address:


mail.example.com -> Roundcube admin.example.com -> VimBAdmin


The main folder for Roundcue is --> /usr/share/roundcube/ And for VimBAdmin --> /usr/local/vimbadmin/public/


In my folder /etc/nginx/sites-available I have two files:


mail.example.com admin.example.com


And I create a symbolik link to the /etc/nginx/sites-enable for each file.


The content of my "mail.example.com" file:



server {
listen 80;
server_name mail.example.com;
root /usr/share/roundcube/;

if ($http_host != "mail.example.com") {
rewrite ^ http://ift.tt/1FBJeLp permanent;
}

index index.php index.html;

location ~ ^/favicon.ico$ {
root /user/share/roundcube/skins/default/images;
log_not_found off;
access_log off;
expires max;
}

location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}

location ~ ^/(README|INSTALL|LICENSE|CHANGELOG|UPGRADING)$ {
deny all;
}
location ~ ^/(bin|SQL)/ {
deny all;
}

# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}

location ~ \.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
}
}


And of my second file: admin.example.com



server {
server_name admin.example.com;


root /usr/local/vimbadmin/public/;
index index.php;

location / {
try_files $uri $uri/ /index.php?$args;
}

location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
}

}


Here's my nginx.conf



user www-data;
worker_processes 4;
pid /run/nginx.pid;

events {
worker_connections 768;
# multi_accept on;
}

http {

##
# Basic Settings
##

sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;

# server_names_hash_bucket_size 64;
# server_name_in_redirect off;

include /etc/nginx/mime.types;
default_type application/octet-stream;

##
# Logging Settings
##

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

##
# Gzip Settings
##

gzip on;
gzip_disable "msie6";

# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

##
# nginx-naxsi config


My final goal:


Access to Roundcube going to mail.example.com And acces to VimBAdmin going to admin.example.com


Thanks



asked 49 secs ago







2 subdomains on same nginx server

Aucun commentaire:

Enregistrer un commentaire