Report this

What is the reason for this report?

NGINX have two url address locations on single domain

Posted on August 5, 2016

Hi, i’m fairly new to NGINX… well Linux in general actually. I’ve managed to successfully set up TechnicSolder on my VM and using “Domain.com” works as would be expected. But i would like to have TechnicSolder using the url of “Domain.com/solder” so i can then have a simple site on 'Domain.com" what is the basic way for me to change this?

i installed NGINX via this guide: https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-centos-7

i’ve tried adding another server block, tried adding another location, but i’m a bit in the dark on how to get two addresses on the one domain, if possible i would rather not have a sub-domain

I essentially have this in my conf.d file (this is just a copy from solder’s example):

server {
    listen 80; #IPv4
    listen [::]:80; #IPv6

    # Host that will serve this project.
    server_name     solder.technicpack.net;

    # Useful logs for debugging.
    access_log      /var/log/nginx/solder.technicpack.com/access.log;
    error_log       /var/log/nginx/solder.technicpack.com/error.log;
    rewrite_log     on;

    # The location of our projects public directory.
    root            /var/www/solder.technicpack.com/htdocs/TechnicSolder/public;
    index index.php;

    location / {
        # URLs to attempt, including pretty ones
        try_files   $uri $uri/ /index.php?$query_string;
    }

    # PHP FPM configuration.
    location ~* \.php$ {
            fastcgi_pass                    unix:/var/run/php5-fpm.sock;
            fastcgi_index                   index.php;
            fastcgi_split_path_info         ^(.+\.php)(.*)$;
            include                         fastcgi_params;
            fastcgi_param PATH_INFO         $fastcgi_path_info;
            fastcgi_param SCRIPT_FILENAME   $document_root$fastcgi_script_name;
    }

    # We don't need .ht files with nginx.
    location ~ /\.ht {
            deny all;
    }

    # Hide dot files/folders
    location ~ .*/\. {
            return 403;
    }
    
    # Set header expirations on per-project basis
    location ~* \.(?:ico|css|js|jpe?g|JPG|png|svg|woff)$ {
            expires 365d;

    }
}

Thank you for your time in reading this Mytyh494

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.