Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifying "Manage Nginx PHP-FPM website" reset vhost conf #15

Open
kintaro1981 opened this issue Apr 28, 2016 · 3 comments
Open

Modifying "Manage Nginx PHP-FPM website" reset vhost conf #15

kintaro1981 opened this issue Apr 28, 2016 · 3 comments

Comments

@kintaro1981
Copy link
Contributor

I activate SSL and the vhost config was reset.

Luckly I backup it before activate it!

@Real-Gecko
Copy link
Owner

What was your config before mod and after?

@kintaro1981
Copy link
Contributor Author

Before:

server {
    include /etc/phpmyadmin/nginx-php5-fpm.conf;
    server_name domain.com www.domain.com;
    listen xxx.xxx.xxx.xxx;

    root /home/domain/public_html;
    index index.html index.htm index.php;
    access_log /var/log/nginx/domain.com_access_log;
    error_log /var/log/nginx/domain.com_error_log;
    fastcgi_param GATEWAY_INTERFACE CGI/1.1;
    fastcgi_param SERVER_SOFTWARE nginx;
    fastcgi_param QUERY_STRING $query_string;
    fastcgi_param REQUEST_METHOD $request_method;
    fastcgi_param CONTENT_TYPE $content_type;
    fastcgi_param CONTENT_LENGTH $content_length;
    fastcgi_param SCRIPT_FILENAME /home/domain/public_html$fastcgi_script_name;
    fastcgi_param SCRIPT_NAME $fastcgi_script_name;
    fastcgi_param REQUEST_URI $request_uri;
    fastcgi_param DOCUMENT_URI $document_uri;
    fastcgi_param DOCUMENT_ROOT /home/domain/public_html;
    fastcgi_param SERVER_PROTOCOL $server_protocol;
    fastcgi_param REMOTE_ADDR $remote_addr;
    fastcgi_param REMOTE_PORT $remote_port;
    fastcgi_param SERVER_ADDR $server_addr;
    fastcgi_param SERVER_PORT $server_port;
    fastcgi_param SERVER_NAME $server_name;
    fastcgi_param HTTPS $https;
    location ~ (^|/)\. {
        return 403;
    }
    location / {
        try_files $uri $uri/ /index.php?q=$uri&$args;
    }
    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_pass unix:/var/run/php5-fpm-domain.com.sock;
    }
    #location per far funzionare invoiceplane
    location /invoiceplane {
        #index index.php;
        try_files $uri $uri/ /invoiceplane/index.php?q=$uri;
    }
    #location per il test infiera, fonte: http://centminmod.com/nginx_configure_xenforo_seo_friendly_urls.html
    location /infiera/ {
        index index.php index.html index.htm;
        try_files $uri $uri/ /infiera/index.php?$uri&$args;

    }

    location /infiera/internal_data/ {
        internal;
        allow 127.0.0.1;
        allow xxx.xxx.xxx.xxx;
        deny all;
      }

    location /infiera/library/ {
        internal;
        allow 127.0.0.1;
        allow xxx.xxx.xxx.xxx;
        deny all;
        }
}

after:

server {
    server_name domain.com www.domain.com;
    listen xxx.xxx.xxx.xxx;
    rewrite ^ https://$server_name$request_uri? permanent;
}

server {
    server_name domain.com www.domain.com;
    listen xxx.xxx.xxx.xxx:443 ssl;
    ssl_certificate /home/domain/ssl.cert;
    ssl_certificate_key /home/domain/ssl.key;
    ssl_protocols TLSv1.1 TLSv1.2;

    root /home/domain/public_html;
    index index.html index.htm index.php;
    access_log /var/log/nginx/domain.com_access_log;
    error_log /var/log/nginx/domain.com_error_log;
    fastcgi_param GATEWAY_INTERFACE CGI/1.1;
    fastcgi_param SERVER_SOFTWARE nginx;
    fastcgi_param QUERY_STRING $query_string;
    fastcgi_param REQUEST_METHOD $request_method;
    fastcgi_param CONTENT_TYPE $content_type;
    fastcgi_param CONTENT_LENGTH $content_length;
    fastcgi_param SCRIPT_FILENAME /home/domain/public_html$fastcgi_script_name;
    fastcgi_param SCRIPT_NAME $fastcgi_script_name;
    fastcgi_param REQUEST_URI $request_uri;
    fastcgi_param DOCUMENT_URI $document_uri;
    fastcgi_param DOCUMENT_ROOT /home/domain/public_html;
    fastcgi_param SERVER_PROTOCOL $server_protocol;
    fastcgi_param REMOTE_ADDR $remote_addr;
    fastcgi_param REMOTE_PORT $remote_port;
    fastcgi_param SERVER_ADDR $server_addr;
    fastcgi_param SERVER_PORT $server_port;
    fastcgi_param SERVER_NAME $server_name;
    fastcgi_param HTTPS $https;
    location ~ (^|/)\. {
        return 403;
    }
    location / {
        try_files $uri $uri/ /index.php?q=$uri&$args;
    }
    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_pass unix:/var/run/php5-fpm-domain.com.sock;
    }
}

@Real-Gecko
Copy link
Owner

Yep, changing setting recreates Nginx config, that's not really flexible, but helps to avoid errors.
There was already a feature request for additional Nginx directives. I'll look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants