When you want redircet a subdomain or domain to an other application with nginx, you must follow the following steps.


I have a Nginx which is used for Plesk 11. Now i want redirct my Subdomain „application.rainbow-six3.com“ to my Webapplication, which runs on port 8080.

1. Go to /etc/nginx
2. Open the file ngnix.conf and add the line „include /etc/nginx/conf.d/*.conf;“ to the http config.

http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server_tokens off;

include /etc/nginx/conf.d/*.conf;

Now Nginx listens to all configuration files in the folder /etc/nginx/conf.d/ when the file ends with „.conf“
3. Go to /etc/nginx/conf.d/
4. Create a new File.
Example: „application_rainbow-six3.conf“
5. Add and following lines in the new file.

server {
#The nginx listens to this ip/port
listen {IP}:80;
#The nginx listens to this domain
server_name {domainname}
client_max_body_size 128m;
#Set path to the root and the access log path
root "/var/www/{domainname}/httpdocs";
access_log /var/www/vhosts/system/{domainname}/logs/proxy_access_log;
#Will be used to redirect
if ($host ~* ^{domainname}$) {
rewrite ^(.*)$ http://{domainname}$1 permanent;
location / {
#Redirect you to the application
proxy_pass http://{IP}:{Port};
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

6. Replace the {IP} with your server ip. This is the IP where ngnix listen to.
7. Replace the {domainname} with your domain or subdomain you want to use.
8. Replced the {Port} with the port of your application
9. Save the file.

server {
server_name application.rainbow-six3.com
client_max_body_size 128m;
root "/var/www/vhostsapplication.rainbow-six3.com/httpdocs";
access_log /var/www/vhosts/system/application.rainbow-six3.com/logs/proxy_access_log;
if ($host ~* ^application.rainbow-six3.com$) {
rewrite ^(.*)$ http://application.rainbow-six3.com$1 permanent;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

10. Restart Nginx with command „services nginx restart“

Now when you open the url http://application.rainbow-six3.com in the browser i will be redirect to port 8080, but the url you see is the normal url without port.


When you want redirect the https you must change the port 80 to 443

When you use Plesk you can add the domain in the Plesk Interface. Now Plesk generate a configuration file for the domain. You find this in the folder „/etc/nginx/plesk.conf.d/vhosts“.
Now follow step 1 – 3.
Then open the file which Plesk have generated and copy the lines for your domain in the new file.(In the file from Plesk, are the configuration for all domains and subdomains, also copy only the Part which you need.)
Then you can follow the step 8 – 10.
On Step 10 you woll get a warning like this:
nginx: [warn] conflicting server name „application.rainbow-six3.com“ on, ignored
This warning is normal. The warning apoiers because nginx found the configuraton from you and one from Plesk. But yours will be used.

Proper supply is an important part of leading a good lifestyle. But can drugs help us? Many families know that drugs are made to help us, but they can detriment us if taken incorrectly. There are medications betrothed only for women. Below are some basic reasons about „Over the Counter Anxiety Medicine„. Is it possible to prevent side effects of Viagra? What health care providers talk about „Best over the counter weight loss pills„? Matters, like „Over the Counter Diet Pills„, are connected a lot of types of heartiness problems. Usually, having nuisance getting an erection can be embarrassing. This medicine is for you only. Never give your medicaments to other men even if theirs symptoms to be the same as yours.

Schreibe einen Kommentar