GVKun编程网logo

Change domain in MAMP -- Virtual hosts

6

以上就是给各位分享ChangedomaininMAMP--Virtualhosts,同时本文还将给你拓展1.8Double-OpeningandVirtualMachine、4:CreateAVirt

以上就是给各位分享Change domain in MAMP -- Virtual hosts,同时本文还将给你拓展1.8 Double-Opening and Virtual Machine、4: Create A Virtualenv(Challenge: Working with the Command Line )、AMQP Connections Channels Virtual Hosts、Apache NameVirtualHost *:80 has no VirtualHosts问题解决办法等相关知识,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!

本文目录一览:

Change domain in MAMP -- Virtual hosts

Change domain in MAMP -- Virtual hosts

Running a Web server on your desktop computer is a great way to speed up Web site development. By previewing your Web pages directly through a Web server on your own computer you can test out server-side programming like server-side include files, form processing scripts, or database-driven Web pages. However, there’s one problem associated with running a server on your own computer: by default, you only have a single "domain"–http://localhost/–so if you work on more than one Web site you put them all under "localhost" in different directories. This isn’t very real world and can cause problems when using server-side includes and root-relative links. Fortunately there’s a better way.

For information on setting up MAMP, visit the MAMP instructions page.

Virtual Hosts

Virtual Hosts give you the ability to "host" more than one Web site and domain on your computer. With a virtual host you can have separate local domain names for each of your Web sites: for example, http://clientA/ for one site andhttp://clientB/ for another. When you type the URL for the Virtual Host in your Web browser, the browser doesn’t go out onto the internet to find the site, but instead asks for the proper file from the Web server running on your computer. Not only does a Virtual Host let you run multiple Web sites on your computer, but it also lets you store the files for those sites anywhere on your computer and not just in the C:\XAMPP\htdocs folder.

Note: You must have administrator privileges on your Mac to do this, so if you’re trying to setup Virtual Hosts on a computer at school, or some other computer that you’re not the admin for, you can’t do this without the help of an administrator.

Adding a Virtual Host is a 2-step process:

  1. Add a new entry to your computer’s hosts file.

    hosts file can be used to point requests for a domain to a particular IP address–in other words, it lets you re-direct communications to a particular domain. In the case of a virtual host, it can tell the computer to NOT go out on the internet when you type a particular URL like http://clientA/, but instead look for that particular domain on your own computer.

  2. Edit the Apache configuration file to accept Virtual Hosts and define the particular Virtual Hosts you want to setup on your computer. The first step above, merely redirects requests from a particular domain to your computer, but this step prepares the Web server on your computer for handling those requests. In this step, you not only provide the name of the Virtual Host, but also tell Apache where the files for the site are located on your computer.

Detailed Steps

  1. Launch Terminal (it’s in the Utilities folder in the Applications folder.

    You’ll be editing a file on your system.

  2. Type: sudo cp /etc/hosts /etc/hosts.bak

    You need admin privileges to work with this file, so you’ll get a prompt for your password. This step is a safety precaution: it makes a back up of the hosts file so that if you make a horrible mistake in the next few steps you can always revert back to the old file by typing: 
    sudo cp /etc/hosts.bak /etc/hosts

  3. Type: sudo pico /etc/hosts

    This opens the hosts file in a text editing program named pico.

  4. Press the down arrow key (or press Ctrl-V) until the cursor appears at the bottom of the file.
  5. Type:
    127.0.0.1    clientA.local

    127.0.0.1 is how a computer refers to itself—it’s an IP address that points back to the computer, kind of like a computer’s way of saying "ME." The second part (clientA.local) is the "domain" of the virtual host. To visit this domain in a Web browser you’d type http://clientA.local. Of course, you should change clientA.local in the above example to match whatever you want the localhost to be. In addition, you don’t have to add the .local part to the hosts files—you could just as easily add 127.0.0.1 clientA and access the site in your Web browser with http://clientA—but I find it helpful for differentiating between a real Web site out on the Internet like clientA.com, and the test sites I have running on my own computer.

  6. Press Ctrl-O, followed by the Return key (this saves the file), followed by Ctrl-X (this closes the file and the pico program.)

    That finishes the first part of this task. You’ve prepared your computer to handle requests to http://clientA.local. Now you need to tell the Web server, Apache, how to handle those requests. You can quit terminal now, you can complete the rest of the tasks with a text editor like TextEdit or even Dreamweaver.

  7. In TextEdit (or any text editor even Dreamweaver) open the Apache configuration file located at Applications:MAMP:conf:apache:httpd.conf

    Note: Make a backup of the httpd.conf file before you edit it. Just in case you make a mistake and Apache won’t start up again.

  8. At the bottom of that file add:
    NameVirtualHost *
    <VirtualHost *>
    DocumentRoot "/Applications/MAMP/htdocs"
    ServerName localhost
    </VirtualHost> <VirtualHost *>
    DocumentRoot "/Users/YOU/sites/clientA/site" ServerName clientA.local </VirtualHost>

    The first five lines of code turn on the Virtual Host feature on Apache, and set up the Applications:MAMP:htdocs folder as the default location for http://localhost. That’s important since you need to be able to access the MAMP web pages at http://localhost/ so that you can use PHPMyAdmin.

    The stuff in yellow represents a single Virtual Host. You’ll add one chunk of code just like this for each Virtual Host (or Web site) on your computer

    Note: Make sure you set the ports to the default Apache and MySQL ports as described on the MAMP instructions page.

    You’ll need to modify the stuff highlighted in blue. The first item — DocumentRoot — indicates where the files for this site are located on your computer. The second part–ServerName — is the name you provided in step 2 above: the virtual host name. For example, clientA.local. The third item — the <Directory> part — is the same path you provided for the DocumentRoot. This is required to let your Web browser have clearance to access these files.

  9. Save and close the Apache configuration file, and restart Apache from the MAPP control panel.
  10. Start a Web browser and type a URL for the virtual host. For example: http://clientA.local/.

    You should now see the home page for your site.

More Virtual Hosts

If you want to add additional Virtual hosts add the proper entry to the hosts file and add another block of text like that in yellow above to the Apache configuration file. For example, say you had another Web site for ClientB. You’d add 127.0.0.1    clientB.local in the hosts file and theApplications:MAMP:conf:apache:httpd.conf would look like this:

NameVirtualHost *
<VirtualHost *>
DocumentRoot "/Applications/MAMP/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *>
DocumentRoot "/Users/YOU/sites/clientA/site"
ServerName clientA.local
</VirtualHost>
<VirtualHost *>
DocumentRoot "/Users/YOU/sites/clientB/site"
ServerName clientB.local
</VirtualHost>

More Information

This site also has instructions for installing MAMP.

1.8 Double-Opening and Virtual Machine

1.8 Double-Opening and Virtual Machine

      Since plug-in will be replaced by RN as following years, what is the future of plug-in? the answer is virtual machine technology.

      Some engineers already have experience of installing a virtual machine on a PC. As long as the computer''s memory is large enough, you can open multiple virtual machines at the same time. On each virtual machine, install QQ software, log in with a different account, and then chat with yourself. Of course, chat with yourself is doesn’t make any sense.

      Can it also support installing one or more virtual machines on an Android system? Someone in China is already doing such work, as what I known, the one who is a high school student ——Lody, when this book is written, he should be already a college student. He has a very famous open source project VirtualApp. This project is in commercial operation now; the other is Yong Zhang, the author of DroidPlugin, he is now full-time entrepreneurs to do this, based on the DroidPlugin, developed a lightning box, you can quickly load a variety of apk through it.

      With such a virtual machine system, we can open two QQ application with different account on the phone and chat with ourselves.

      The multiple instances technology that opens an app at the same time called Double-Opening. Some mobile phone systems in China now support double-opening technology. You can see this option in the settings of the Android phone.

      Regarding to the technology of double-opening and virtual machines, there is only a brief about them. After all, it is out of this book scope.

4: Create A Virtualenv(Challenge: Working with the Command Line )

4: Create A Virtualenv(Challenge: Working with the Command Line )

You''ll want to isolate the Python environment that your script is in by creating a virtual environment. This will allow you to install Python packages with the versions that the script expects.

Instructions

  • Create a Python 3 virtualenv called script.
  • Activate the script virtualenv

/home/dq$ virtualenv -p /usr/bin/python3 script                                 

Running virtualenv with interpreter /usr/bin/python3                            

Using base prefix ''/usr''                                                        

New python executable in /home/dq/script/bin/python3                            

Also creating executable in /home/dq/script/bin/python                          

Installing setuptools, pip, wheel...                                                                                                            

/home/dq$ source script/bin/activate                                            

(script) /home/dq$ 

AMQP Connections Channels Virtual Hosts

AMQP Connections Channels Virtual Hosts

REF:

https://www.rabbitmq.com/tutorials/amqp-concepts.html


其中一个 connection 上可以创建多个 channel,一个 channel 对于一个 queue。


Connections

AMQP connections are typically long-lived. AMQP is an              application level protocol that uses TCP for reliable              delivery. AMQP connections use authentication and can be              protected using TLS (SSL). When an application no longer needs              to be connected to an AMQP broker, it should gracefully close              the AMQP connection instead of abruptly closing the underlying              TCP connection.

         

Channels

Some applications need multiple connections to an AMQP              broker. However, it is undesirable to keep many TCP              connections open at the same time because doing so consumes              system resources and makes it more difficult to configure              firewalls. AMQP 0-9-1 connections are multiplexed with              channels that can be thought of as "lightweight              connections that share a single TCP connection".

For applications that use multiple threads/processes for              processing, it is very common to open a new channel per thread/process              and not share channels between them.

Communication on a particular channel is completely separate              from communication on another channel, therefore every AMQP              method also carries a channel number that clients use to              figure out which channel the method is for (and thus, which              event handler needs to be invoked, for example).

         

Virtual Hosts

To make it possible for a single broker to host multiple              isolated "environments" (groups of users, exchanges,              queues and so on), AMQP includes the concept of virtual              hosts (vhosts). They are similar to virtual hosts used              by many popular Web servers and provide completely isolated              environments in which AMQP entities live. AMQP clients              specify what vhosts they want to use during AMQP connection              negotiation.


Apache NameVirtualHost *:80 has no VirtualHosts问题解决办法

Apache NameVirtualHost *:80 has no VirtualHosts问题解决办法

当启动apache的时候,如果事件管理器出现“Apache NameVirtualHost *:80 has no VirtualHosts”错误时,大部分是因为修改了apache的httpd.conf配置文件,将extra/vhosts.conf文件引入到httpd.conf中了。

复制代码 代码如下:
# Virtual hosts
Include conf/extra/httpd-vhosts.conf

httpd-vhosts.conf文件中有一句配置语句为

复制代码 代码如下:

NameVirtualHost *:80

如果httpd-vhosts.conf中没有存在类似:
复制代码 代码如下:

<VirtualHost *:80>
    ServerAdmin webmaster@jb51.net
    DocumentRoot "D:/WAPM/www"
    ServerName www.jb51.net
    ServerAlias www.jb51.net
    ErrorLog "logs/www.jb51.net-error.log"
    CustomLog "logs/www.jb51.net-access.log" common
</VirtualHost>

配置节,就会在事件管理器中出现Apache NameVirtualHost *:80 has no VirtualHosts错误。加上同上面的配置节就不会出现这个错误了。

您可能感兴趣的文章:

关于Change domain in MAMP -- Virtual hosts的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于1.8 Double-Opening and Virtual Machine、4: Create A Virtualenv(Challenge: Working with the Command Line )、AMQP Connections Channels Virtual Hosts、Apache NameVirtualHost *:80 has no VirtualHosts问题解决办法等相关知识的信息别忘了在本站进行查找喔。

本文标签:

上一篇[转]Python定时任务框架APScheduler

下一篇Format Currency Sample