Is it safe to host a website outside public_html - shared-hosting

I am hosting a website where i host my main site in the /home/username/public_html
while i host my blog in /home/username/blog
is it safe that i host the blog in a different folder (/home/username/blog )

There is nothing special about a directory called "public_html" other than that the web server are often configured to look for content there (and some web servers do so by default).
The name is just a convention.

Related

How to publish WCF service on IIS 7

I have developed and published (via the "publish" feature in VS 2013) a simple WCF web service on IIS on my local machine.
The physical deploy path is the folder : c:\inetpub\wwwroot\MyWCF_Service_On_IIS\
I saw on IIS that the virtual folder has been created under "default Web site" (with the same name : MyWCF_Service_On_IIS). The default web site listens on port 80.
Why there is no way to access the service ? whatever combination of paths and urls fails.
I tried :
localhost/MyWCF_Service_On_IIS/Service1.svc (Service1.svc is the .svc file hosting the only endpoint);
localhost/Service1.svc
127.0.0.1/MyWCF_Service_On_IIS/Service1.svc
127.0.0.1/Service1.svc
localhost
127.0.0.1
Even if I don't expose metadata endpoints I expect to see a least a help page about the service and how to get the metadata themselves.
But I only get errors
Whatever attempt I do fails miserably.
I would like to know, once and for all, what is the rule IIS uses to map virtual folders to physical folders.
We are supposed to directly deploy all related files/file directories to the root folder of the website by using FileSystem mode.
C:\inetpub\wwwroot
Moreover, we need to enable windows features to handle the SVC extension for supporting WCF service.
There is no need to use a virtual folder in that case.
Here is the content of the wwwroot folder on my side.
bin folder
PrecompiledApp.config
Service.svc
Web.config
The service URL is http://localhost/service.svc
If we specify the URL by using a virtual path. We should convert the virtual path to the application.
Then the service URL is http://localhost/MyWCF/Service1.svc.
Feel free to let me know if the problem still exists.

Different virtual hosts for same website but different pages

My web server directory is as follows:
var/www/html/site-part-1
var/www/html/site-part-2
In site-part-1, I have a wordpress installation, and when a person lands on my site by google organic / direct whatever when they type in the domain into addres bar it will take user to site-part-1
Currently site-part-1 is operational with the virtual host configuration directory root directory set to var/www/html/site-part-1
But I have a completely different system in site-part-2, that is built with python which I will be accessing via a link from the wordpress site.
example.com (site-part-1) will have a link, and it will take the user to my website example.com/my/directory and in /my/directory will be the contents of site-part-2
It may have worked sticking site-part-2 in the wordpress site folder but for cleanliness I put it into seperate folder
Does anyone know how I should go about setting up my apache settings so that both directories work together?

How to point a domain to a laravel installation folder on shared hosting

I've installed Laravel 5.3 on shared hosting inside public_html/NitsEditor folder though SSH Terminal, the core domain of the hosting is something different i.e. "noeticitservices.com" and it has wordpress installed in it, so the laravel home page appears into noeticitservices.com/NitsEditor/public/
I've a domain named "nitseditor.com" I want to have public/index.php under this domain name.
I've configured the DNS of the domain to the IP address of my shared hosting and also added the domain through cpanel, while doing this I can see there is a folder named public_html/nitseditor.com is created.
Please guide me how can I achieve this.
While creating domain through cpanel set path public_html/NitsEditor/public/

Server Alias in IIS

I would like to create the equivalent of Apache Server Alias entries in IIS 7.5. Anyone know how to do this?
If I understand Apache's Server Aliases correctly, then what you're looking for is a Virtual Directory. In IIS manager, right-click a website or folder and select "Add Virtual Directory." You can then add a directory to the website with a specific alias (which will form part of the Url) and physical path (which can be anywhere on disk, not necessarily under the root folder of the website).
EDIT: suspecting that I've confused Apache's "alias" and "server alias" functions: you may be looking for an IIS site's "Bindings", which allow multiple domain names to be mapped to specific web applications.

How to prevent hackers from exploiting Apache ->Sites-available -> Default file

We noticed that a hacker created a domain and configured DNS to point it to our server's IP address.
We are using apache2.x on Ubuntu.
There is a "default" file in apache's /etc/apache2/sites-available directory and it looks like the the hacker's domain is using "default" apache configuration file to display our web content in their domain.
How can we prevent this?
Can some one post a "default" apache configuration file as an example?
Unknown domains that come into apache over the specified ip and port will be directed to the first virtual host, thus the 000-default file. Your best bet is to make the 000-default host return a 400 or 500 error (or some explicit message saying the domain doesn't belong) and use explicit virtualhosts for each of your sites.
+1 Jeremy's answer: make the default (first) virtual host for each IP address you're listening on return something useless like a 404 or page saying nothing but “this is a virtual server”.
Allowing your web server to serve a real web site on a non-matching ‘Host’-name (including a raw IP address) opens you up to two particular attacks:
DNS rebinding attacks, leading to cross-site scripting into your real web site.
This affects sites with a user access element (eg. logging in, cookies, supposedly-private intranet apps).
‘Search-hijacking’. This affects all sites (even completely static ones). This may be what is happening to you. By pointing their own domain name at your server, they can make search engines see both the real domain name and their fake one as duplicates for the same site. By using SEO techniques they can then try to make their fake address seem like the more popular, at which point the search engines see that as the canonical address for the site, and will start linking to it exclusively instead of yours.
Most web servers are configured by default to serve a web site to all-comers, regardless of what hostname or IP address they're accessing it through. This is a dangerous mistake. For all real live sites, configure it to require that the ‘Host’ header matches your real canonical hostname.