I have a VPS server with Ubuntu 18 O.S. In this VPS I have installed VESTA CP, which comes with Apache 2 and Nginx. After that I have intalled Tomcat 9(port 8082) to serve a Java Spring based webapp. If I enter the address "serverIP:8082/AppFolder" I can access the app, but I want to redirect the apache server to the tomcat one, so I can write the domain name and load the webapp.
I have tried .htaccess file but it shows an apache error page. I have no permission to view this file is the message.
What can I do to solve this?
-Nginx config:
location / {
proxy_pass http://IP: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/webapp.com/public_html;
access_log /var/log/apache2/domains/webapp.com.log combined;
access_log /var/log/apache2/domains/webapp.com.bytes bytes;
expires max;
try_files $uri @fallback;
}
}
location /error/ {
alias /home/admin/web/webapp.com/document_errors/;
}
location @fallback {
proxy_pass http://IP:8080;
}
-Apache config:
<VirtualHost IP:8080>
ServerName webapp.com
ServerAlias www.webapp.com
ServerAdmin [email protected]
DocumentRoot /home/admin/web/webapp.com/public_html
ScriptAlias /cgi-bin/ /home/admin/web/webapp.com/cgi-bin/
Alias /vstats/ /home/admin/web/webapp.com/stats/
Alias /error/ /home/admin/web/webapp.com/document_errors/
#SuexecUserGroup admin admin
CustomLog /var/log/apache2/domains/webapp.com.bytes bytes
CustomLog /var/log/apache2/domains/webapp.com.log combined
ErrorLog /var/log/apache2/domains/webapp.com.error.log
<Directory /home/admin/web/webapp.com/public_html>
AllowOverride All
Options +Includes -Indexes +ExecCGI
php_admin_value open_basedir /home/admin/web/webapp.com/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/webapp.com/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.webapp.com.conf*
</VirtualHost>
Thanks.
Finally I have found an answer...editing the config file of nginx:
Default config file has the Apache port and apache html pages path. I suppose this can be done using apache proxy_mod, but I donĀ“t know which way is better...if anyone can explain the two ways(via apache or via nginx) I apreciate it.