nginx 配置

Posted 小V_chen

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了nginx 配置相关的知识,希望对你有一定的参考价值。

server {
    listen 80;
    server_name admin.mailejingcai.com;
    access_log logs/credits.access.log;

    root /vagrant/admin.mailejingcai.com/web;

    location / {
        index index.php;
        if (!-e $request_filename){
          rewrite ^/(.*) /index.php last;
        }
    }

    location ~ \.php(?|$) {
        #fastcgi(php-fpm) listening on 127.0.0.1:9000
        #root /var/www/html/techbrood/web;
        #your path to fastcgi_params file
        
    include /usr/local/nginx/conf/fastcgi_params; 
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass 127.0.0.1:9000;
        #fastcgi_pass unix: /var/run/php-fpm.sock
    }

    location ~ \.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$ {
        root /vagrant/admin.mailejingcai.com/web;
    }
}

cd /usr/local/nginx/conf/vhosts

以上是关于nginx 配置的主要内容,如果未能解决你的问题,请参考以下文章

Nginx——Nginx启动报错Job for nginx.service failed because the control process exited with error code(代码片段

Nginx配置文件详细介绍

Nginx 跨域

Nginx的配置

VSCode自定义代码片段11——vue路由的配置

VSCode自定义代码片段11——vue路由的配置