skip to Main Content

When i start octane it always use this host http ://127.0.0.1:8000 , which is usable in local development, but in production environnement i use domain name instead of localhost
Is there a way to change the hostname like http ://domain.com:8000 when we start octane.

Update:
I’m using apache

Update:
I switched to Nginx so, it works better than apache. But if someone managed to resolve this in Apache feel welcome to leave your configuration.

2

Answers


  1. You need Nginx or Apache. It’s already on Octane Documentation.

    In the Nginx configuration example below file, Nginx will serve the site’s static assets and proxy requests to the Octane server that is running on port 8000:

    map $http_upgrade $connection_upgrade {
        default upgrade;
        ''      close;
    }
    
    server {
        listen 80; // or 8000
        listen [::]:80; // or 8000
        server_name domain.com;
        server_tokens off;
        root /your/octane_path/public;
    
        index index.php;
    
        charset utf-8;
    
        location /index.php {
            try_files /not_exists @octane;
        }
    
        location / {
            try_files $uri $uri/ @octane;
        }
    
        location = /favicon.ico { access_log off; log_not_found off; }
        location = /robots.txt  { access_log off; log_not_found off; }
    
        access_log off;
        error_log  /var/log/nginx/domain.com-error.log error;
    
        error_page 404 /index.php;
    
        location @octane {
            set $suffix "";
    
            if ($uri = /index.php) {
                set $suffix ?$query_string;
            }
    
            proxy_http_version 1.1;
            proxy_set_header Host $http_host;
            proxy_set_header Scheme $scheme;
            proxy_set_header SERVER_PORT $server_port;
            proxy_set_header REMOTE_ADDR $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection $connection_upgrade;
    
            proxy_pass http://127.0.0.1:8000$suffix;
        }
    }
    
    Login or Signup to reply.
  2. You can change the hostname by passing the option --host=your-host to the octane command.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search