Skip to content

Instantly share code, notes, and snippets.

@petemcw
Last active February 2, 2024 11:50
Show Gist options
  • Select an option

  • Save petemcw/9265670 to your computer and use it in GitHub Desktop.

Select an option

Save petemcw/9265670 to your computer and use it in GitHub Desktop.
Mac OS X LEMP Configuration
----------------------------------------------------------------------
# http://wiki.nginx.org/NginxMainModule
#----------------------------------------------------------------------
user prm staff;
worker_processes 2;
pid /usr/local/var/run/nginx/nginx.pid;
#----------------------------------------------------------------------
# http://wiki.nginx.org/NginxEventsModule
#----------------------------------------------------------------------
events {
worker_connections 1024;
accept_mutex off;
}
#----------------------------------------------------------------------
# http://wiki.nginx.org/NginxHttpCoreModule
#----------------------------------------------------------------------
http {
access_log /usr/local/var/log/nginx/access.log;
error_log /usr/local/var/log/nginx/error.log warn;
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] $request '
'"$status" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
# This tells Nginx to ignore the contents of a file it is sending
# and uses the kernel sendfile instead
sendfile on;
# Set this to on if you have sendfile on
# It will prepend the HTTP response headers before
# calling sendfile()
tcp_nopush on;
# This disables the "Nagle buggering algorithm" (Nginx Docs)
# Good for websites that send a lot of small requests that
# don't need a response
tcp_nodelay on;
# timeouts
keepalive_timeout 25;
send_timeout 30;
# general options
charset utf-8;
server_tokens off;
server_name_in_redirect off;
ignore_invalid_headers on;
recursive_error_pages on;
merge_slashes on;
underscores_in_headers on;
limit_conn_zone $binary_remote_addr zone=limit_per_ip:16m;
types_hash_max_size 2048;
server_names_hash_bucket_size 128;
client_max_body_size 24m;
client_body_buffer_size 128k;
#proxy_read_timeout 18000;
# compression
gzip on;
gzip_http_version 1.0;
gzip_proxied any;
gzip_vary on;
gzip_static on;
gzip_min_length 1024;
gzip_buffers 32 8k;
gzip_comp_level 6;
gzip_types text/plain text/css application/x-javascript text/comma-separated-values text/xml application/xml application/xml+rss application/atom+xml text/javascript;
gzip_disable "MSIE [1-6].(?!.*SV1)";
# PHP-FPM
upstream phpfpm {
#server unix:/usr/local/var/run/nginx/phpfpm.sock;
server 127.0.0.1:9000;
}
# include active sites
include /usr/local/etc/nginx/sites-enabled/*;
}
@floor3
Copy link
Copy Markdown

floor3 commented Apr 19, 2015

Thanks for this gist. I had to install xcode-select first for get this working "xcode-select --install".

@petemcw
Copy link
Copy Markdown
Author

petemcw commented Aug 25, 2015

No problem @floor3. I know I've found it useful whenever I setup a new machine. I updated the README with the Xcode command in case others don't already have it installed. Thanks!

@clonn
Copy link
Copy Markdown

clonn commented Sep 18, 2016

thanks for your script, that is helpful.

@aredhelrim
Copy link
Copy Markdown

Thanks for gist but when trying to install php71 i m getting these

brew install php71 --with-fpm --without-apache --with-homebrew-curl --with-homebrew-openssl --without-snmp
==> Installing php71 from homebrew/php
Warning: homebrew/php/php71: this formula has no --with-fpm option so it will be ignored!
Warning: homebrew/php/php71: this formula has no --with-homebrew-openssl option so it will be ignored!
Warning: homebrew/php/php71: this formula has no --without-apache option so it will be ignored!
Warning: homebrew/php/php71: this formula has no --without-snmp option so it will be ignored!

@AlternativeYeah
Copy link
Copy Markdown

@aredhelrim now the default php-fpm, checking all options
#brew options php71

@jp2kdev
Copy link
Copy Markdown

jp2kdev commented Nov 26, 2017

Help me please!
I found a message when i test command nginx -t.
kosin$ nginx -t
nginx: [warn] the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /usr/local/etc/nginx/nginx.conf:4
nginx: [emerg] BIO_new_file("/usr/local/etc/nginx/ssl/localhost.pem") failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/usr/local/etc/nginx/ssl/localhost.pem','r') error:2006D080:BIO routines:BIO_new_file:no such file)
nginx: configuration file /usr/local/etc/nginx/nginx.conf test failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment