Openshift PHP application - Virtual Host - apache

I have a php application on openshift. This main application is actually made of 2 different parts: Students & Employees. As I want to keep the code clear and separate for each (even though they share some common data), I need to create Virtual Host in Openshift.
After the user logs in, depending on what his setting was - I want to direct him to either the student or the employee management section. For example say my main application is https://manage.example.com, when the user logs in I want to be able to direct him to a virtual directory(host?) such as
https://manage.example.com/student OR
https://manage.example.com/employee
I am a little new to web related development but I 'assume' that Virtual host may be the right thing? If yes then any clues or leads on how to set up Virtual hosts on Openshift as I understand I have limited access to server configuration files on Openshift.

You will not be able to create more virtual hosts on OpenShift Online for one application, however, there are a couple of other routes that you can go.
You could create two separate applications (each having their own gears) and run each part of your code on a different application. If you need to share a database between them, make sure that you create one of them as scaled (the one you add the database to). Note that these two applications will not share a filesystem.
You could setup each application to run in it's own "subdirectory", something like you had proposed above, you should be able to easily setup the different routes in your application, this would also allow the applications to share a filesystem.

Related

Weblogic. Add one more domain with SOA

I have got task, to add one more domain with SOA app to Weblogic server. As I understand, I have to run RCU and create schemas for new domain before running ./config.sh
The problem is that I not sure is this correct solution. There is a lot step by step manuals how to create domain, but is there any differences when adding second domain?
Thanks
You cannot add domain to WebLogic server. Domain is like logical grouping of related WebLogic servers. You can either extend existing domain to include SOA application or create whole new domain with SOA application. In both cases you will need to run RCU at some point before initially lunching your domain. It's best that you read/follow oracle documentation related to your specific version of WebLogic/Oracle Fusion Middleware.
To add second domain, at first you have to run RCU:
cd RCU_HOME/bin
./rcu
and create new repository. When repository is created, you need to run config.sh:
cd SOA_ORACLE_HOME/common/bin
./config.sh to create new domain.
Be careful when creating soa_server: ports numbers used for soa and admin server shouldn't be the same, as in first domain, and soa_server name should be different.
More info about creating domain you can find here:
https://oracle-base.com/articles/11g/weblogic-11g-create-extend-and-remove-domains
and here:
http://docs.oracle.com/cd/E28280_01/install.1111/e14318/qisoa.htm#CACCAEBE

VB.net create Active Directory account on another domain

I have two Active Directory forests on separate domains. Call them Domain1 and Domain2.
I want to be able to run this application from a computer in Domain1 and it will create an account in Domain2. I know this can be done in PowerShell by using new-pssession. Any help is appreciated.
-M
Excellent tutorial on all things .net -> AD.
http://www.codeproject.com/Articles/19689/Working-with-Active-Directory-in-VB-NET
You'll need to make sure that you have access to LDAP/ADSI from where ever you run the application though. Being on another domain isn't the issue, not being inside the current network where the AD server resides is, usually these things aren't internet facing due to it being a massive security concern.

One Magento installation with two websites, on separate vhosts

I have a client that maintains two different websites, each of which is set up as a separate virtual host in Apache. I installed and configured a Magento store within one host at domain1.com/store. They client now wants a store set up at domain2.com/store that shares products with the store on domain1.
All the instructions that I've seen to set up multiple websites within Magento require that the different websites be on the same host. Unfortunately, that isn't an option with our current setup. What's the best way to implement this?
So i think you should first think about your structure and what you're trying.
1.) Magento supports a multishop solution. For this you create many shops in one instance. Then you can set the Magento store in your vhost file with SET ENV or direct in your index.php file like this:
switch($_SERVER['HTTP_HOST']) {
case 'domain1.com':
$_SERVER["MAGE_RUN_CODE"] = "domain2";
$_SERVER["MAGE_RUN_TYPE"] = "store";
break;
default:
$_SERVER["MAGE_RUN_CODE"] = "domain1";
$_SERVER["MAGE_RUN_TYPE"] = "store";
break;
}
You have to change your index.php file that Magento know which shop the system should call (Create the shops in your Magento configuration).
2.) When you need more hosts Then make one database. Install the shop with all sites and then copy them to a new location. In the new location you can set the shop with the snippet in step 1.
Then you can build many hosts with one database but if you want with one administration and one database.
When you build the second solution you should think about that the database server should be in the same network.Otherwise you get a very bad performance.
You should point both Vhosts to the same magento install??
Then in the backend/admin section add a separate "Store"? Magento is totally designed to do this:
See Here
You can share store inventory, or keep it separated. You can also share main Template files -- Or keep them separated ... Share Skin files -- Or keep them separated. Point both vhosts to the same install directory and let Magento do the job it was designed for, without ever having to do the heavy Server Administration task of separating two installs by domain, but having the same Install.

A web application that lets users choose a domain name for the website they are about to create?

I want to create a web application that allows users to sign up, register a domain name and create their own website. This will be done in Ubuntu 9.10, Apache 2, Mysql 5 and Php 5.
At the moment, the only area of development I'm uncertain about is the domain name registration and mapping it to the web application.
I'm going to postpone developing the web interface that lets users register domains because I don't have the slightest idea how to do it. For the time being, I'll let an employee register the domain name on the user's behalf. I'll automate the process in te future (any advice on this matter would be appreciated). The employee will also input the registered domain name into my CMS, which will also update the Apache VirtualHost files with new domain information. I will have a cron job reload Apache every 5 minutes to capture the virtualhost changes.
Does this sound like the right approach? Will what I'm about to do be very disruptive to the server? Can anyone offer suggestions or point out issues I need to be aware of?
Additional details
the documentroot will remain the same at /var/www/public_html/websitemaker/ for all domains. I'll track user settings and styles based on the PHP's $_SERVER variable
I don't believe restarting apache every 5 minutes is the way to go as it won't be good for scaling.
One option would be to use logic grab the the domain name used to access the site. Verify that against your list of accounts in MySQL. If there is a match then load the users site and if not then behave like normal or send to error page.
As for registering domain names you will need to create (or use and existing) a script implenting an API to the registrar of your choice. They will provide the ability to check if a domain is available or not and to register it assigning it specific DNS values (plus other options as well) all in real time.
I think what you're looking for is Apache with mass virtual hosting so that you don't have to restart/reload Apache every 5 mins. Any specific questions about this would be more appropriate for Serverfault.

IIS 6 - Create a virtual directory that points to an IIS application on a different server?

Here's the scenario:
Server A is hosting the 'main' application (www.example.com)
Server B is hosting a support application (b.example.com)
They are connected internally to each other through a 192.* address and are both externally available through DNS
Server A has several virtual directories that are mapped through UNC shares:
www.example.com/virtual1 -> \192.168.1.1\virtual1 (on serverB)
I'd like to be able to run the application that sits on Server B (served through IIS) and make it appear as if it's running on serverA:
www.example.com/application -> b.example.com/app
I'd still want to be able to access server B directly
b.example.com/app
Any ideas?
Edit:
Turns out the application behind the proxy refused to let me dynamically change it's form "action" (nor did it let me change anything else). I was able to display the data from the server; just couldn't post :(
So both answers pointed me in the right direction. I used a proxy:
http://code.google.com/p/iisproxy/
I created a virtual directory on Server A that matched the directories I needed on Server B - and it worked! :-)
This should be possible in IIS. I remember I had to do this once.
Just create a virtual directory using the UNC path pointing to \\ServerB\SharedAppDirOnB and (if necessary) "Connect As..." using the credentials needed for Server B.
If you have problems with "Connect As..." it could be a folder permissions problem of Server B. Try the following thing: add a new user account on your main server which has the same name and password as the account on Server B. It sounds stupid, but I remember it solved my issue. You could for example add a new user account on both servers: "IisCommon" with the same passwords on both servers. Then make sure you give all necessary file access permission to the folder on server B (and the Share permission!). Try first connecting manually using Windows Explorer if you can access the share.
Make sure that you mark the new virtual directory as application and give the right execution permissions.
Another solution would be some kind of reverse proxy. I used a third-party product on IIS 6.0 for this: ISAPIrewrite for IIS. The "proxy" mode allows you to "forward" request made to your main server (www.example.com/...) to your other server, but serving the resulting responses as if they were processed by your main "domain" application. The feature is called "proxy directive". It accepts regular expressions.
Since serving the virtual directory from server A through a UNC share apparently does not work, you need to serve b.example.com/app from server b.
DNS resolves domain names to IP addresses. You are asking for the same domain name to resolve to two different IP addresses, based on a different URL. This is not something that IIS or Windows can do.
Your options are:
write a proxy service on server A that passes requests on to server B. If you want it completely transparent (not just a redirect), you'd have to stream back the response as well. This is not trivial, but possible.
Put the server B page into an IFRAME on a new page on server A.
Use a load balancer in front of both servers that can split traffic based on URL