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

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

Related

How to find a web application folder based on url? Tomcat or JBoss

I have an URL of a application running like "server":8080/"application". I know that the server is JBoss or Tomcat. I have the access to the server(linux) and I would like to copy this application to other server, so I have to find the .war or .ear file to migrate. I tried running some "find" commands to search about the extension or something based on the name but I canĀ“t find it. Is there a way to discover the folder based only in the url that is used to access? Regards,

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.

.htaccess Rewriting Tomcat Server

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

Access file in weblogic server

Is there a folder in the Domain Directory of Weblogic, where files put inside can be accessed directly from web browser? In other word, I don't have to pack the file in an ear, war file and deploy it to make it accessible?
Thank you very much
Regards
K.
The Virtual Directory Mapping feature (that you declare in the weblogic.xml) would do the trick:
Using the virtual directory mapping
feature, you can create one directory
to serve static files such as images
for multiple Web Applications. For
example, you would create a mapping
similar to the folowing:
<virtual-directory-mapping>
<local-path>c:/usr/gifs</local-path>
<url-pattern>/images/*</url-pattern>
</virtual-directory-mapping>
A request to
http://localhost:7001/mywebapp/images/test.gif
will cause your WebLogic Server
implementation to look for the
requested image at:
c:/usr/gifs/images/*.
This directory must be located in the
relative uri, such as
"/images/test.gif".

Where should you save your IIS files

May seem like a dumb question... but where should you save your website files in IIS?
If i need to make a WCF application should I just put the code in the wwwroot folder and convert the WCF folder into application?
Thanks
Its generally good to create a virtual directory and point it to the actual physical location, instead of putting all your files/projects in wwwroot folder

Resources