Webinoly is just the perfect tool for NGINX experts. Give it a try!
0 votes
2.8k views
by Rookie

i want to install pterodactyl but i am struggling with the ssl part...

i found this one: 

NGINX Setup per site

If need to add additional NGINX rules, you can have your own custom configuration file located at /var/www/domain.com and it should be named following the pattern *-nginx.conf, for example: custom-nginx.conf would be a valid filename.

so i created a file in /var/www/gsm.domain.tld" named "gsm.domain.tld-nginx.conf" and entered this: https://pterodactyl.io/panel/webserver_configuration.html#nginx

but while i want to restart nginx, i am getting such an error: 

Dec 23 16:57:07 v220191211003xxxxxx nginx[11992]: nginx: [emerg] "server" directive is not allowed here in /var/www/gsm.domain.tld/gsm.domain.tld-nginx.conf:3

Dec 23 16:57:07 v220191211003xxxxxx nginx[11992]: nginx: configuration file /etc/nginx/nginx.conf test failed

 what am i doing wrong? how am i able to solve this issue?

1 Answer

0 votes
by Expert

You don't need the Nginx rules you are trying to add, all of them are already in Webinoly. Seems like you are new and still learning about these topics, so please read the Webinoly documentation, and also you can find a lot of tutorials in Google about Nginx.

  • Create your site: sudo site domain.com -php
  • Add an SSL cert: sudo site domain.com -ssl=on
After that, all the Nginx rules will be automatically there. wink
by Rookie

but there are differences between the ptero nginx-file and gsm.domain.tld located in /etc/nginx/sites-available. 

in the ptero nginx-file are things that do not exist in gsm.domain.tld like:

server_tokens off;

[...]

    # allow larger file uploads and longer script runtimes

    client_max_body_size 100m;

    client_body_timeout 120s;

    sendfile off;

[...]

# See https://hstspreload.org/ before uncommenting the line below.

    # add_header Strict-Transport-Security "max-age=15768000; preload;";

    add_header X-Content-Type-Options nosniff;

    add_header X-XSS-Protection "1; mode=block";

    add_header X-Robots-Tag none;

    add_header Content-Security-Policy "frame-ancestors 'self'";

    add_header X-Frame-Options DENY;

    add_header Referrer-Policy same-origin;

[...]

    location / {

        try_files $uri $uri/ /index.php?$query_string;

    }

    location ~ \.php$ {

        fastcgi_split_path_info ^(.+\.php)(/.+)$;

        fastcgi_pass unix:/run/php/php7.2-fpm.sock;

        fastcgi_index index.php;

        include fastcgi_params;

        fastcgi_param PHP_VALUE "upload_max_filesize = 100M \n post_max_size=100M";

        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

        fastcgi_param HTTP_PROXY "";

        fastcgi_intercept_errors off;

        fastcgi_buffer_size 16k;

        fastcgi_buffers 4 16k;

        fastcgi_connect_timeout 300;

        fastcgi_send_timeout 300;

        fastcgi_read_timeout 300;

        include /etc/nginx/fastcgi_params;

    }

    location ~ /\.ht {

        deny all;

    }

what do I have to do with the code?

by Expert
It is not just one file (sites-available), code is dispersed in several conf files. As I said before, please, read the documentation and try different things before asking. There is a lot of info on Google to learn if you want.
Welcome to the Community site for Webinoly.

Our Optimized LEMP Web Server is a powerful set of commands for doing just about anything you could wish.

With Webinoly you can set up your NGINX web server in just one step.

* * * * * * *

To report a bug, please create a new issue on GitHub or ask a question here with the bug tag.
Webinoly Support Paypal Donations

PayPal · GitHub Sponsors · Bitcoin

It is very important that any visitor to the site read the disclaimer, terms of use and privacy and legal statement before start browsing.

...