Question
NGINX have two url address locations on single domain
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
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×