Welcome Guest, Not a member yet? Register   Sign In
How to make both Nuxtjs and CI4 works with NGINX under the same domain?
#1

(This post was last modified: 02-27-2021, 07:23 AM by simonickalexs.)

So, what I need is like:
- example.test #this is the nuxt app
- example.test/api #this is the ci4 app

This is my current configuration (I'm using wamp.net on windows)
Code:
server
{
    listen 127.0.0.1:80;
    listen 127.0.0.1:443 ssl;
    server_name example.test;
    root "D:/Wamp.NET/sites/example/server/public/";
    
    # ssl
    ssl_certificate "D:/Wamp.NET/bin/2-nginx_1.19.6_x86/conf/vhosts/example.test.crt";
    ssl_certificate_key "D:/Wamp.NET/bin/2-nginx_1.19.6_x86/conf/vhosts/example.test.key";
    ssl_session_cache shared:SSL:1m;
    ssl_session_timeout 5m;
    ssl_ciphers HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers on;
    
    gzip            on;
        gzip_types      text/plain application/xml text/css application/javascript;
        gzip_min_length 1000;
    
    location / {
        #proxy_redirect                      off;
        #proxy_set_header X-Real-IP          $remote_addr;
        #proxy_set_header X-Forwarded-For    $proxy_add_x_forwarded_for;
        #proxy_set_header X-Forwarded-Proto  $scheme;
        #proxy_read_timeout                  1m;
        #proxy_connect_timeout               1m;

        # Websocket support
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;

        # Proxy to the Node.JS instance of the client app
        proxy_pass http://localhost:3000;
    }
    
    location /public {
        root "D:/Wamp.NET/sites/example/client/static/";
    }
    
    location /api {
        try_files $uri $uri/ /index.php$is_args$args;
    }
    
    location ~ \.php$ {
        fastcgi_pass 127.0.0.1:7415;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
    
    location ~ /\.ht {
        deny all;
        }
}

But the current config throw error "404 File Not Found Can't find a route for 'api'.".
Any help would be appreciated. Thank you  (:
Reply




Theme © iAndrew 2016 - Forum software by © MyBB