Jump to content

Config files for nginx and sphinx


tjk

Recommended Posts

Hello Folks,

Was wondering (hoping) someone would be willing to share their nginx and sphinx config files for a 4.x deployment.  Looking for proper friendly URLs rewrites, performance, sphinx wildcard searches and stuff like that.

Thanks in advance for your kindness!

 

Link to comment
Share on other sites

This is my working nginx config (CentOS 7.1, nginx 1.8, php-fpm):

Notice: I only use HTTPS (that is why I redirect port 80 to 443).

/etc/nginx/nginx.conf

user  nginx;
worker_processes  4;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    access_log  /var/log/nginx/access.log;

    sendfile        on;
    tcp_nopush     on;

    keepalive_timeout  65;

    gzip  on;

    gzip_types text/css application/javascript;

    gzip_vary on;

    server_tokens off;

    charset utf-8;

    ssl_session_cache shared:SSL:1m;
    ssl_session_timeout  5m;

    ssl_ciphers  HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers   on;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

    include /etc/nginx/conf.d/*.conf;
}

/etc/nginx/conf.d/myips4site.com.conf

server {
    listen       80;
    server_name  www.myips4site.com;

    access_log /var/log/nginx/myips4site.com_access.log;
    error_log /var/log/nginx/myips4site.com_error.log;

    return 301 https://www.myips4site.com$request_uri;
}

server {
    listen       443 ssl spdy;
    server_name  myips4site.com;

    access_log /var/log/nginx/myips4site.com_access.log;
    error_log /var/log/nginx/myips4site.com_error.log;

    ssl_certificate      /my/private/path/to/ssl/certificate.pem;
    ssl_certificate_key  /my/private/path/to/ssl/certificate.key;

    root /home/myips4site.com/public_html;
    index index.html index.php;

    try_files $uri $uri/ /index.php;

    location ~* \.(?:css|gif|jpg|js|png|ico)$ {
        expires max;
        add_header Cache-Control "public";
    }

	location ~ [^/]\.php(/|$) {
		if (!-f $document_root$fastcgi_script_name) {
			return 404;
		}
		fastcgi_split_path_info ^(.+\.php)(/.+)$;
		fastcgi_pass   unix:/var/run/php-fpm/myips4site.com.socket;
		fastcgi_index  index.php;
		fastcgi_param PATH_INFO $fastcgi_path_info;
		fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
		include        fastcgi_params;
	}
}

server {
    listen       80;
    server_name  myips4site.com;

    access_log /var/log/nginx/myips4site.com_access.log;
    error_log /var/log/nginx/myips4site.com_error.log;

    return 301 https://myips4site.com$request_uri;
}

server {
    listen       443 ssl spdy;
    server_name  myips4site.com;

    access_log /var/log/nginx/myips4site.com_access.log;
    error_log /var/log/nginx/myips4site.com_error.log;

    ssl_certificate      /my/private/path/to/ssl/certificate.pem;
    ssl_certificate_key  /my/private/path/to/ssl/certificate.key;

    return 301 https://www.myips4site.com$request_uri;
}

 

Link to comment
Share on other sites

The config above works like a charm with rewrites.

Hmm, odd, I thought you had to have a rewrite to get the friendly url rewrites to work.

I'm having a really odd issue.  If I start a new topic, and use numbers in the title, I get the below error, yet the new thread gets posted.  If I reply to a thread with only numbers, I get the same error and the message gets posted twice.  This is on 4.0.8.1.

 

 

Sorry, there is a problem

Something went wrong. Please try again.

Error code: EX1064

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...