ThinkPHP5 builds a CMS system from scratch (2)

Continuing from the previous section, open the wamp integrated environment, and enter http://localhost/cms/public in the browser address bar to run the project, but the domain name here is too long, so do something about it.

Note: To view all tp5 tutorials, please click the thinkphp5 tab navigation on the right.

1. Domain redirection

(1) Configure the httpd.conf file

Open the wamp installation directory and find the httpd.conf file in the bin->apache->apache version->conf directory (as shown in the figure below)

Find an IDE to open this file, I use a lightweight notepad++ here, enter at the bottom of the file code

<VirtualHost *:80>
    DocumentRoot "E:\wamp\www\cms\public"
    ServerName cms.cn
</VirtualHost>

DocumentRoot corresponds to the wamp installation directory

ServerName is the domain name address defined by yourself

As shown below:

(2) Configure the host file

Open My Computer, copy C:\Windows\System32\drivers\etc in the address bar , paste (fixed directory), enter the folder, and find the host file (as shown in the figure below)

Open with IDE, copy 127.0.0.1 cms.cn , paste, save (system permissions may be required when saving, just confirm)

(3) Restart wamp and enter: http://cms.cn in the browser address bar to preview the project successfully.

However, when we enter http://localhost in the address bar , it will also jump to the tp5 program, which is not what we want, modify the httpd.conf file

Restart wamp, then enter http://localhost again , correct

To be continued,

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325950932&siteId=291194637