.htaccess Rewriting Tomcat Server - .htaccess

I am writing a website using Railo. My code is to be deployed on a Railo Server running on Tomcat, overlayed on a regular Apache+PHP server.
I need to send all requests to http://subdomain.myserver.co.uk/ and its child files to the directory /public_html/railo/tomcat/webapps/ROOT/subdomain/ directory.
I defined a subdomain in cPanel, with the document root as /public_html/railo/tomcat/webapps/ROOT/subdomain/, but still requests to http://subdomain.myserver.co.uk/ display files in /public_html/railo/tomcat/webapps/ROOT/. I can view my files if I request http://subdomain.myserver.co.uk/subdomain/
I've been fiddling with the .htaccess files for quite some time now, but I'm stuck
Is there any way I can do what I'm trying to achieve, or am I resigned to get those pages using http://subdomain.myserver.co.uk/subdomain/

The Railo documentation on adding a site to a Railo/Tomcat/Apache/Linux install is here:
http://wiki.getrailo.org/wiki/Installation:InstallerDocumentation:LinAddingSites
I would also personally recommend against putting your site files in ROOT/sitedir/ because the ROOT directory is already configured for localhost, and making a subdirectory into another site will cause overlapping host configs in the WEB-INF directories.
Instead, just use whatever the default is for your control panel, and update your Tomcat server.xml file to point to the directory that your control panel naturally puts sites in. This will make your Railo site and your control panel work very smoothly together.
Hope this helps!

If you want your tomcat application to serve at example.com and not at example.com/application then you need to deploy your application at /ROOT and not at /application. This will make it the "default web application" so it'll be able to serve directly from example.com.
Have a look at: http://tomcat.apache.org/tomcat-5.5-doc/config/context.html

Cherouvim's answer didn't work for me. Eventually I ended up putting my entire application in the ROOT directory

Related

Valet not working on kali linux. Redirecting to htdocs

I installed valet on Kali Linux, and pinged a test domain to make sure it's working which it is. However, after running valet park in the folder directory that I have my files. It redirects me to xampp dashboard whenever I access the route on the browser. I know very well to type the folder name followed by a .test domain. I've tried almost everything online. I see this is a popular issues and I've gone through every possible solution I see online. It's still not working, I tried to rename the index.php file in the htdocs folder which gets render automatically whenever you access the htdocs folder, now it only list the folder structure for me as a result. I tried to move the project out of htdocs still not working. I stopped apache and tried accessing it again but unfortunately I got, "This site cant be reached"
No response.. Well fortunately i was able to fix it, not sure it's the best way. But hopefully this might help someone, i configured ssl on the domain with valet using valet secure foo.bar and it automatically redirect to https. That way, i was able to escape from xampp

Cpanel is not giving me option to change the root directory for one of my domains

I need to change the root directory for one of my domains,
But in my cpanel i dont find any options, just hard cores of system, but i have very basic knowledge about systems and servers.
How i can change that directory as easy as possible? I just need to change something because im gonna install laravel, and i want to change the public html to the public of laravel.
I was looking for the file that has the apache config, but it says like "the current config doesnt need to be changed or updated, bacause can be overryde", so i tought in Cpanel maybe i got an option for this.
Thanks, By the way i got an VPS, not shared. Using CENTOS 7.9.
Thanks and good night ^^
In cPanel, you can't change main domain directory/document root. If you want to change the document root, just change the main domain to another/random domain. Then add the domain that you want to change the root directory as addon domain
It's not recommended overriding Apache config. It's may break your system. WHM/cPanel exists to manage domains without a system admin knowledge
Do you try change this using console in Centos?
maybe will be better using console and open the file that contain the directory root

Using IIs as it I would use Apache

I want to use IIS the way I use Apache. With that, I mean to, for example, create a simple html file, with only a "hello" message, put this file inside the IIS folder and then be able to access this html page thru eg.: localhost/mypage.html.
I can't figure it out how to make this. I've searched on Google, but nine has helped me.
My doubts are:
The IIS server is turned on, I saw this on the IIS Manager. So, what are the folder that I should place my html file and what are the default port that IIS uses so I can access my html file via localhost?
Create a new website and point to the folder where your html file resides
GO to IIS Manager->Right Click on Sites -> Add Website
Are you getting the localhost default screen
Restart Your server as whole,
See if the IIS Worker Process is running on the task manager,

How can I move my old sites from shared host server to VPS?

I'm sure a lot of you guys used to be in the same situation as I am at right now.
Before
I used to owned shared hosting for about 2 years.
I kind of get used to it, whenever I create a new site.
I just need to upload my entire new folder including : index.html , styles, scripts, and other assets via FTP into the root directory to my shared host server. Then, I go to the url of that folder, I will see the site loaded, that's how I normally do it.
Now
I upgrade the way I host my site. I just recently purchased a VPS on Digital Ocean, and run Laravel application on it. Now, the site is way faster, and I have more control.
Unfortunately, I'm not sure what to do with all my old sites that I used to have.
How do move them into my new VPS ?
How do I go to them ? How is that work ?
Should I create a public_html folder or something ?
How can I achieve something like this ?
Any direction on this will be much appreciated !
Depending on your setup (single domain, multi-domain). If you're dealing with a single domain environment you'll just move everything over like normal. If you're in a multi-domain environment you'll need to point all your domains to the new server and setup different apache sites (config files) that point to their respective locations on disk.
In my experience with multi-domain environments and Apache 2.4 it's best to have /var/www/ be your center where you can store your .htpasswd or any other files like that, and a folder named public which has your outward facing websites in their subfolders.
Example:
web1.com would exist in /var/www/public/web1.com/...
web2.com would exist in /var/www/public/web2.com/...
You could alternatively have another public folder, but if you're specifically asking about laravel you'd want to point the apache config to the public directory as if you go any higher people have access to your .env file.
If you have everything in your single domain environment (public_html) and you now have a laravel site at your root you could alias a specific path to act as your "old site" data that points to a different folder than your laravel install.

How to access resources(images/mp3) from outside the jetty webroot folder?

I have a Java web application placed in /home/jetty/webapps/ folder on a Jetty server.
I want to be able to serve static files like song.mp3, img.jpg, etc to my web application from a folder /media/resources/ which is completely outside the jetty web root.
Can I access resources placed outside the jetty root?
If so, how can I accomplish this?
Thanks in advance for any help!
yes ,you can use apache httpd server set htdoc use /media/resources/
easy, here is an example that lets you serve multiple directories aggregated together under one url
http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded/SplitFileServer.java?h=jetty-9
there are other fileserver embedded examples under there as well

Resources