Jump to content

nginx reverse proxy vestacp


Recommended Posts

Posted
Hello

I use Vestacp on Ubuntu.

I've created a subdomain called Tv.

How to connect x.x.x.x: 8096 to this subdomain.

Please guide me.


 

Thank

thatoneguy99
Posted

You have access to the nginx config?

 

 

Sent from my phone!

  • Like 1
Posted (edited)

You have access to the nginx config?

 

 

Sent from my phone!

 

Yes

 

Direction: /home/admin/conf/web

 

598fc0d31eea9_my.jpg

 

nginx.conf

server {
    listen      xxx.xxx.xxx.xxx:80;
    server_name tv.xxxxxxx.tk www.tv.xxxxxx.tk;
    error_log  /var/log/apache2/domains/tv.xxxxxxx.tk.error.log error;

    location / {
        proxy_pass      http://xxx.xxx.xxx.xxx:8080;
        location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
            root           /home/admin/web/tv.xxxxxxx.tk/public_html;
            access_log     /var/log/apache2/domains/tv.xxxxxxx.tk.log combined;
            access_log     /var/log/apache2/domains/tv.xxxxxxx.tk.bytes bytes;
            expires        max;
            try_files      $uri @fallback;
        }
    }

    location /error/ {
        alias   /home/admin/web/tv.xxxxxxx.tk/document_errors/;
    }

    location @fallback {
        proxy_pass      http://xxx.xxx.xxx.xxx:8080;
    }

    location ~ /\.ht    {return 404;}
    location ~ /\.svn/  {return 404;}
    location ~ /\.git/  {return 404;}
    location ~ /\.hg/   {return 404;}
    location ~ /\.bzr/  {return 404;}

    include /home/admin/conf/web/nginx.tv.xxxxxxx.tk.conf*;
}

snginx.conf

server {
    listen      xxx.xxx.xxx.xxx:443;
    server_name tv.xxxxxxx.tk www.tv.xxxxxxx.tk;
    ssl         on;
    ssl_certificate      /home/admin/conf/web/ssl.tv.xxxxxxx.tk.pem;
    ssl_certificate_key  /home/admin/conf/web/ssl.tv.xxxxxxx.tk.key;
    error_log  /var/log/apache2/domains/tv.xxxxxxx.tk.error.log error;

    location / {
        proxy_pass      https://xxx.xxx.xxx.xxx:8443;
        location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
            root           /home/admin/web/tv.xxxxxxx.tk/public_html;
            access_log     /var/log/apache2/domains/tv.xxxxxxx.tk.log combined;
            access_log     /var/log/apache2/domains/tv.xxxxxxx.tk.bytes bytes;
            expires        max;
            try_files      $uri @fallback;
        }
    }

    location /error/ {
        alias   /home/admin/web/tv.xxxxxxx.tk/document_errors/;
    }

    location @fallback {
        proxy_pass      https://xxx.xxx.xxx.xxx:8443;
    }

    location ~ /\.ht    {return 404;}
    location ~ /\.svn/  {return 404;}
    location ~ /\.git/  {return 404;}
    location ~ /\.hg/   {return 404;}
    location ~ /\.bzr/  {return 404;}

    include /home/admin/conf/web/snginx.tv.xxxxxxx.tk.conf*;
}

apache2.conf

<VirtualHost xxx.xxx.xxx.xxx:8080>

    ServerName tv.xxxxxxx.tk
    ServerAlias www.tv.xxxxxxx.tk
    ServerAdmin info@tv.xxxxxxx.tk
    DocumentRoot /home/admin/web/tv.xxxxxxx.tk/public_html
    ScriptAlias /cgi-bin/ /home/admin/web/tv.xxxxxxx.tk/cgi-bin/
    Alias /vstats/ /home/admin/web/tv.xxxxxxx.tk/stats/
    Alias /error/ /home/admin/web/tv.xxxxxxx.tk/document_errors/
    #SuexecUserGroup admin admin
    CustomLog /var/log/apache2/domains/tv.xxxxxxx.tk.bytes bytes
    CustomLog /var/log/apache2/domains/tv.xxxxxxx.tk.log combined
    ErrorLog /var/log/apache2/domains/tv.xxxxxxx.tk.error.log
    <Directory /home/admin/web/tv.xxxxxxx.tk/public_html>
        AllowOverride All
        Options +Includes -Indexes +ExecCGI
        php_admin_value open_basedir /home/admin/web/tv.xxxxxxx.tk/public_html:/home/admin/tmp
        php_admin_value upload_tmp_dir /home/admin/tmp
        php_admin_value session.save_path /home/admin/tmp
    </Directory>
    <Directory /home/admin/web/tv.xxxxxxx.tk/stats>
        AllowOverride All
    </Directory>

    <IfModule mod_ruid2.c>
        RMode config
        RUidGid admin admin
        RGroups www-data
    </IfModule>
    <IfModule itk.c>
        AssignUserID admin admin
    </IfModule>

    IncludeOptional /home/admin/conf/web/apache2.tv.xxxxxxx.tk.conf*

</VirtualHost>

sapache2.conf

<VirtualHost xxx.xxx.xxx.xxx:8443>

    ServerName tv.xxxxxxx.tk
    ServerAlias www.tv.xxxxxxx.tk
    ServerAdmin info@tv.xxxxxxx.tk
    DocumentRoot /home/admin/web/tv.xxxxxxx.tk/public_html
    ScriptAlias /cgi-bin/ /home/admin/web/tv.xxxxxxx.tk/cgi-bin/
    Alias /vstats/ /home/admin/web/tv.xxxxxxx.tk/stats/
    Alias /error/ /home/admin/web/tv.xxxxxxx.tk/document_errors/
    #SuexecUserGroup admin admin
    CustomLog /var/log/apache2/domains/tv.xxxxxxx.tk.bytes bytes
    CustomLog /var/log/apache2/domains/tv.xxxxxxx.tk.log combined
    ErrorLog /var/log/apache2/domains/tv.xxxxxxx.tk.error.log
    <Directory /home/admin/web/tv.xxxxxxx.tk/public_html>
        AllowOverride All
        SSLRequireSSL
        Options +Includes -Indexes +ExecCGI
        php_admin_value open_basedir /home/admin/web/tv.xxxxxxx.tk/public_html:/home/admin/tmp
        php_admin_value upload_tmp_dir /home/admin/tmp
        php_admin_value session.save_path /home/admin/tmp
    </Directory>
    <Directory /home/admin/web/tv.xxxxxxx.tk/stats>
        AllowOverride All
    </Directory>
    SSLEngine on
    SSLVerifyClient none
    SSLCertificateFile /home/admin/conf/web/ssl.tv.xxxxxxx.tk.crt
    SSLCertificateKeyFile /home/admin/conf/web/ssl.tv.xxxxxxx.tk.key
    SSLCertificateChainFile /home/admin/conf/web/ssl.tv.xxxxxxx.tk.ca

    <IfModule mod_ruid2.c>
        RMode config
        RUidGid admin admin
        RGroups www-data
    </IfModule>
    <IfModule itk.c>
        AssignUserID admin admin
    </IfModule>

    IncludeOptional /home/admin/conf/web/sapache2.tv.xxxxxxx.tk.conf*

</VirtualHost>

Edited by mafiaman
thatoneguy99
Posted

This is how I have mine set up. It's not on a subdomain though. You have other things on the subdomain? So you're trying to access Emby at sub.domain.com/tv? Or tv.domain.com?

Here is what I have.

 

#Emby RP
        location /emby {
                proxy_pass http://localhost:8096;
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        } 

Sent from my phone!

  • Like 1
thatoneguy99
Posted

Depending on what exactly you're trying to do, I can try and help out.

 

 

Sent from my phone!

  • Like 1
Posted

Depending on what exactly you're trying to do, I can try and help out.

 

 

Sent from my phone!

Thanks for help

sub domain: tv.mydomain.com

 

config nginx for subdomain:

server {
    listen      xxx.xxx.xxx.xxx:80;
    server_name tv.xxxxxxx.tk www.tv.xxxxxx.tk;
    error_log  /var/log/apache2/domains/tv.xxxxxxx.tk.error.log error;

    location / {
        proxy_pass      http://xxx.xxx.xxx.xxx:8080;
        location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
            root           /home/admin/web/tv.xxxxxxx.tk/public_html;
            access_log     /var/log/apache2/domains/tv.xxxxxxx.tk.log combined;
            access_log     /var/log/apache2/domains/tv.xxxxxxx.tk.bytes bytes;
            expires        max;
            try_files      $uri @fallback;
        }
    }

    location /error/ {
        alias   /home/admin/web/tv.xxxxxxx.tk/document_errors/;
    }

    location @fallback {
        proxy_pass      http://xxx.xxx.xxx.xxx:8080;
    }

    location ~ /\.ht    {return 404;}
    location ~ /\.svn/  {return 404;}
    location ~ /\.git/  {return 404;}
    location ~ /\.hg/   {return 404;}
    location ~ /\.bzr/  {return 404;}

    include /home/admin/conf/web/nginx.tv.xxxxxxx.tk.conf*;
}

thatoneguy99
Posted

What happens when you go to tv.mydomain.com right now?

 

 

Sent from my phone!

Posted

What happens when you go to tv.mydomain.com right now?

 

 

Sent from my phone!

yes

thatoneguy99
Posted

Try to add what I posted to the bottom of your conf file. Right above the include part. Then go to tv.mydomain.com/emby and tell me what you get. Did you add all of that stuff in your conf file or is that how vestacp had it when you created the subdomain?

 

 

Sent from my phone!

thatoneguy99
Posted

What is running on port 8080? Anything that you know of? What do you get when you run

sudo service nginx status

Sent from my phone!

thatoneguy99
Posted

Sorry there's some details I have to know which I why I have all of the questions.

 

 

Sent from my phone!

Posted

What is running on port 8080? Anything that you know of? What do you get when you run

sudo service nginx status
Sent from my phone!

 

nginx error

 

Is it possible to send private server details to you privately?
Fix this problem and then explain to me what you have done.
thatoneguy99
Posted (edited)

I can try. Can you ssh into your server?

 

Better question is how do you access your server normally?

 

Sent from my phone!

Edited by thatoneguy99
Posted

I can try. Can you ssh into your server?

 

Better question is how do you access your server normally?

 

Sent from my phone!

Information was sent to you via the private message

pir8radio
Posted (edited)

 

Thanks for help

sub domain: tv.mydomain.com

 

config nginx for subdomain:


        location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
           

You cant limit emby to specific extensions like you have in the location, emby uses lots of images with no extensions on them, just header values.  You are missing all kinds of config settings, look at the examples people have provided you and/or look here: https://emby.media/community/index.php?/topic/48236-setting-up-emby-behind-a-reverse-proxy-nginx/?p=457670

Edited by pir8radio
  • Like 1
  • 4 weeks later...
Posted (edited)
Hello
 
Thank you friends who posted.
I found the answer and put it here if other friends like me use vestacp to do this.
My Domain: https://myDomain.com
Subdomain: http://vip.mydomain.com
 
method:
Change nginx config in the following way:
/etc/nginx/conf.d/IP.conf
 
server {
     listen xxx.xxx.xxx.xx: 80 default;
     server_name vip.mydomain.com;
     #access_log /var/log/nginx/xxx.xxx.xxx.xx.log main;
     location / {
         proxy_pass http://127.0.0.1:8096;
    }
}
 
Good luck

<script> </script>

<script> </script>

Edited by mafiaman

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...