如何在nginx中新建一个域名

1.使用  lnmp vhost add 命令,进入添加界面

2.

[root@VM_0_14_centos /]# lnmp vhost add
+-------------------------------------------+
|    Manager for LNMP, Written by Licess    |
+-------------------------------------------+
|              https://lnmp.org             |
+-------------------------------------------+
Please enter domain(example: www.lnmp.org): www.xxx.com

#其中填写自己的域名

3.

Enter more domain name(example: lnmp.org *.lnmp.org): 

此后直接回车

4.

Default directory: /home/wwwroot/www.xxx.com: /home/wwwroot/xxx

此项是为该域名设置根目录,最后的xxx可以自定义

5.

Allow Rewrite rule? (y/n) y

#是否设置重写规则,我这里只是为了演示,所以直接设置为空
Please enter the rewrite of programme, 
wordpress,discuzx,typecho,thinkphp,laravel,codeigniter,yii2 rewrite was exist.
(Default rewrite: other): 
You choose rewrite: other

6.

#是否使用返回路径

Enable PHP Pathinfo? (y/n) y
Enable pathinfo.

7.

#是否设置访问日志
Allow access log? (y/n) y

8.

#输入自定义的域名访问日志,如果使用默认的,直接回车
Enter access log filename(Default:www.xxx.com.log): 
You access log filename: www.xxx.com.log

9.

#是否创建相同名称的数据库和mysql用户
Create database and MySQL user with same name (y/n) n

10.

#是否添加ssl证书
Add SSL Certificate (y/n) n
11.如此一个域名就创建创建成功了!其中命令可以根据自己的实际业务进行改变.

猜你喜欢

转载自blog.csdn.net/qq1719448063/article/details/82562426