ubuntu 18 lnmp

1安装Nginx

sudo apt-get install nginx

2安装PHP

sudo apt-get install php7.2 php7.2-fpm

3安装mysql

sudo apt-get install mysql

启动|Nginx 服务

sudo service nginx  reload|restart|start

4添加多域名

server {
    listen 85 default_server;
    listen [::]:85 default_server; 
    root /home/frings/Work/HeYinERPWeb/web;
    index index.html index.htm index.nginx-debian.html index.php;
    server_name _;
    location / {
        try_files $uri $uri/ =404;
    }
    location ~ .+\.php($|/) {
            set $script $uri;
            set $path_info "/";
            if ($uri ~ "^(.+\.php)(/.+)") {
                    set $script $1;
                    set $path_info $2;
            }
   
            fastcgi_pass unix:/run/php/php7.2-fpm.sock;
            include /etc/nginx/fastcgi_params;
            fastcgi_param PATH_INFO $path_info;
            fastcgi_param SCRIPT_FILENAME $document_root/$script;
            fastcgi_param SCRIPT_NAME $script;
    }
}

如果想要域名的方式 需要

1将配置中的 server_name 更换

2在 /etc/hosts 文件中添加 127.0.0.1  对应的域名

猜你喜欢

转载自www.cnblogs.com/lt-com/p/9122157.html
今日推荐