ArticleDirectory
- Enable the multi-site Function
- Run a site
- Delete a site
- Test multiple sites on the local machine
- References
When you run orchard, a website usually runs in an application. Program Domain. This is also the general ASP. NET application to distinguish two websites, that is, two websites need to be deployed. However, orchard provides another method to distinguish two websites. The concept of multi-site (Multi-Tenancy) is introduced in orchard, which is a multi-tenant concept, but I think it is more appropriate to translate multiple sites), allowing you.. NET application domain. From the perspective of memory usage, this is very useful because the initialization, uninstallation, and recovery of application domains are very resource-consuming. You can run multiple independent orchard websites in a single application domain to configure more sites on one server. As a host hosting vendor, this method will undoubtedly be favored, which can greatly save costs. For leasing users of a host space, you can also deploy multiple sites in a host space to save money. The multi-site feature performs better in the Windows azure environment, because deployment to Azure can easily support multiple sites. Remarks
If you want to test the multi-site function on the local machine, read the "test multi-site on Local Machine" section and then read this article.
The multi-site feature is disabled by default. To enable the multi-site function, log on to the background management system, click the modules menu, find the multi tenancy function under the hosting category, and click Enable.
Once the multi-site function is enabled, you can see a tenants menu in the background management system (tenants menu appears only when you access the default site, this means that only the administrator of the default site can create a sub-site ). Click here to view a default site, which is created by default when orchard is installed. You can imagine that default is like a tenant renting a whole house. Of course, you can also rent this house to more people.
Add a site
First, you only have one single site, which is the default site. To add a new site, click "add a tenant ".
- On the Add Site Page, enter the site name (the name cannot contain spaces) and site domain name. Orchard maps the domain name accessed by the user to the corresponding website. In addition, you can set the database used by this site. There are three options:
- Allow the site to set up its own database.
- Use a separate SQL Server compact database
- Use an existing SQL Server database
After setting the preceding attributes, click "save" to view the added site in the site list. Click set up to go to the orchard installation page. If you do not select "allow the site to configure the database by yourself", no database configuration options will appear.
RemarksIf you select the Database Installation option to use an existing database, you must enter the existing database connection string and table prefix. In this way, a website uses an independent database. I think this implementation method is better than the dnn method that does not mix data from different sites into one table. Each site running a website can have its own unique content project, enable different functional modules, use different themes for unique configuration. However, the modules available for each site are the same. This is because they all share the same website program, so the same is true for available modules. The following describes how to use different themes on different sites.
You can also stop a site at any time. You only need to click "Suspend" in the tenants menu of the default site to stop the site. You can also click "resume" to enable the corresponding site at any time after stopping the service. Currently, the page does not provide a button to delete a site. However, you can find a subdirectory with the same name in the app_data/sites directory of the website and delete it. You can also back up the directory to other places so that you can use it when you want to restore it. Remarks
On Azure, there is no way to delete it, unless you delete the actual database and change the configuration from blob storage.
Test multi-site on the local machine. If you want to configure the multi-site function on the local machine, you must first modify the local hosts file. Set multiple domain names pointing to the local IP address. The hosts file is usually in \ windows \ system32 \ drivers \ etc \ hosts. Open the file in notepad and add the following records. 127.0.0.1 T1.myhost. com127.0.0.1 T2.myhost.com. You need to bind these domain names to IIS. Taking IIS 7 as an example, you can select the corresponding orchard site, right-click to find the "Edit binding" item, and then add the domain name added to the hosts file in the website binding dialog box. In this way, you can use the two new domain names in the orchard website to create two new sites. Reference http://orchardproject.net/docs/Setting%20Up%20a%20Multi-Tenant%20Orchard%20Site.ashx