-
Notifications
You must be signed in to change notification settings - Fork 1
LEMP
The LEMP stack configured in these documents is established in contrast to the popular LAMP Stack used to power many popular web applications. The LEMP configuration replaces the Apache web server component with nginx.
nginx (pronounced "engine X"), is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server, written by Igor Sysoev in 2005. Nginx is the only supported web server for GitLab.
nginx root has been moved to /db/www/nginx/html
NOTE:
most Linux distro will create /etc/nginx/sites-availables
. Fedora will instead use /etc/nginx/conf.d
. All additional web services conf files shall be placed in this directory.
The main configuration file is located at /etc/nginx/nginx.conf
. Edit it to change basic settings.
/etc/nginx/nginx.conf
------------------------
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
error_log /storage/log/nginx/error.log notice;
error_log /storage/log/nginx/error.log info;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /storage/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
server {
listen 80 default_server;
server_name enl.global www.enl.global;
root /db/www/nginx/html;
location / {
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
# pass the PHP scripts to FastCGI server listening on the php-fpm socket
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
}
Start and enable nginx
% sudo systemctl status nginx
● nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
Active: active (running) since Fri 2015-05-08 16:00:03 CEST; 5s ago
Process: 13222 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
Process: 13221 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
Main PID: 13223 (nginx)
CGroup: /system.slice/system-systemd\x2dnspawn.slice/systemd-nspawn@poppy.service/system.slice/nginx.service
├─13223 nginx: master process /usr/sbin/nginx
└─13224 nginx: worker process
May 08 16:00:03 poppy systemd[1]: Starting The nginx HTTP and reverse proxy server...
May 08 16:00:03 poppy nginx[13221]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
May 08 16:00:03 poppy nginx[13221]: nginx: configuration file /etc/nginx/nginx.conf test is successful
May 08 16:00:03 poppy systemd[1]: Started The nginx HTTP and reverse proxy server.
- Make sure of correct access rights to php5-fpm.sock
# ls a- /run
..........
srw-rw---- 1 nginx www-data 0 May 28 14:10 php5-fpm.sock