Sample Header Ad - 728x90

What is the equivalent of localhost in Debian using nginx?

0 votes
1 answer
2380 views
Every nginx config guide I find is about setting up the server for, say, example.com. But I don't have a domain name, and I want to set up a local DNS, something like localhost in Windows with Apache that comes with XAMPP. I want to create two ports, which is I believe server blocks in nginx. One of the ports is for api, one of the ports is for the frontend. I have created two files: /etc/nginx/conf.d/chubak.conf: server { listen 85; server_name chubak.com; access_log /srv/logs/vue.access.log; error_log /srv/logs/vue.error.log; gzip_static on; # root /srv/default; root /var/www/chubak.com/html; index index.html; location / { add_header 'Access-Control-Allow-Origin' '*'; try_files $uri $uri/ /index.html; } And /etc/nginx/conf.d/api.chubak.conf: server { listen 180; server_name api.chubak.com; access_log /var/www/api.chubak.com/logs/api.access.log; error_log /var/www/api.chubak.com/logs/api.error.log; root /var/www/api.chubak.com/html; index index.php index.html; client_max_body_size 128M; location / { try_files $uri $uri/ /index.php?_url=$uri&$args; } location ~ \.php$ { include /etc/nginx/fastcgi.conf; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; try_files $uri =404; fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; fastcgi_read_timeout 600; fastcgi_intercept_errors on; gzip off; fastcgi_index index.php; } And I've created index.html files in the /var/www/site/html folder, but I don't know how to access them. As I said, the tutorials always assume that you have a domain name pointed to your server.
Asked by Major Despard (57 rep)
Apr 17, 2019, 05:59 PM
Last activity: Apr 20, 2025, 02:07 AM