Pejman Moghadam / Slackware

Slackware 13.37 - Installing Nginx, PHP, MySQL (with epkg)

Public domain


Create mysql user

groupadd mysql
useradd -r -g mysql mysql

MySQL installation

cd /usr/src
wget -c "http://pmoghadam.com/homepage/Pages/Deposit/Source-packages/mysql-5.5.22.tar.gz"
su - install
cd /usr/src
tar xf mysql-5.5.22.tar.gz
cd mysql-5.5.22
cmake . \
  -DCMAKE_INSTALL_PREFIX=/usr/local/nginx/mysql \
  -DMYSQL_DATADIR=/var/lib/nginx-mysql \
  -DWITH_ARCHIVE_STORAGE_ENGINE=1 \
  -DWITH_FEDERATED_STORAGE_ENGINE=1 \
  -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
  -DINSTALL_LAYOUT=STANDALONE \
  -DENABLED_PROFILING=ON \
  -DMYSQL_MAINTAINER_MODE=OFF \
  -DWITH_DEBUG=OFF \
  -DWITH_SSL=yes
make
make install DESTDIR=/usr/local/encap/nginx-mysql-5.5.22
logout
cd /usr/local/encap/
chown -R root:root nginx-mysql-5.5.22/ 
mkencap nginx-mysql-5.5.22
epkg nginx-mysql-5.5.22

prepair database and my.cnf

cd /var/lib/
mkdir -p ./nginx-mysql
chown -R mysql ./nginx-mysql
chgrp -R mysql ./nginx-mysql

cd /usr/local/nginx/mysql/ 
chown -R mysql .
chgrp -R mysql .
scripts/mysql_install_db --user=mysql --datadir=/var/lib/nginx-mysql
chown -R root .

egrep -v '^#|^ *$' support-files/my-medium.cnf > /usr/local/nginx/mysql/my.cnf
sed -i -e 's/^log-bin=/#log-bin=/' /usr/local/nginx/mysql/my.cnf
sed -i -e 's/^binlog_format=/#binlog_format=/' /usr/local/nginx/mysql/my.cnf

/usr/local/nginx/mysql/my.cnf

[client]
port                = 3306
socket              = /var/lib/nginx-mysql/mysql.sock
[mysqld]
port                = 3306
socket              = /var/lib/nginx-mysql/mysql.sock
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
server-id   = 1
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
[myisamchk]
key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout

Start mysqld for the first time

/usr/local/nginx/mysql/bin/mysqld_safe  \
    --defaults-file=/usr/local/nginx/mysql/my.cnf \
    --user=mysql \
    --datadir=/var/lib/nginx-mysql \
    --pid-file=/var/lib/nginx-mysql/mysql.pid \
    --skip-networking &

Secure installation wizard

env MYSQL_UNIX_PORT=/var/lib/nginx-mysql/mysql.sock \
    /usr/local/nginx/mysql/bin/mysql_secure_installation

Enter current password for root (enter for none):
Set root password? [Y/n] y 
Remove anonymous users? [Y/n] y 
Disallow root login remotely? [Y/n] n 
Remove test database and access to it? [Y/n] y 
Reload privilege tables now? [Y/n] y

Create appropriate mysql command line client

cat > /usr/local/sbin/mysql-nginx << EOF
env MYSQL_UNIX_PORT=/var/lib/nginx-mysql/mysql.sock /usr/local/nginx/mysql/bin/mysql \$*
EOF
chmod +x /usr/local/sbin/mysql-nginx

Startup script: /etc/rc.d/rc.mysqld-nginx

#!/bin/bash
#
# /etc/rc.d/rc.mysqld-nginx
#

BASEDIR="/usr/local/nginx/mysql/"
DATADIR="/var/lib/nginx-mysql"
PID="${DATADIR}/mysql.pid"

# Disable networking
SKIP="--skip-networking"

# Start mysqld:
mysqld_start() {
  # Remove stale pid file
  if [ -r ${PID} ]; then
    if ! ps ax | grep -v grep | egrep -q 'mysqld'; then
      echo "Cleaning up stale pid file: ${PID}"
      rm -f ${PID}
    fi
  fi

  ${BASEDIR}/bin/mysqld_safe --defaults-file=/usr/local/nginx/mysql/my.cnf \
    --user=mysql --datadir=${DATADIR} --pid-file=${PID} $SKIP & 
}

# Stop mysqld:
mysqld_stop() {
  # If there is no PID file, ignore this request...
  if [ -r ${PID} ]; then
    kill $(cat ${PID})
    # Wait at least one minute for it to exit, as we don't know how big the DB is...
    for second in $(seq 1 60); do
      if [ ! -r ${PID} ]; then
        break;
      fi
      sleep 1
    done
    if [ "$second" == "60" ]; then
      echo "WARNING:  Gave up waiting for mysqld to exit!"
      sleep 15
    fi
  fi
}

# Restart mysqld:
mysqld_restart() {
  mysqld_stop
  mysqld_start
}

case "$1" in
'start')
  mysqld_start
  ;;
'stop')
  mysqld_stop
  ;;
'restart')
  mysqld_restart
  ;;
*)
  echo "usage $0 start|stop|restart"
esac

Normal startup

chmod +x /etc/rc.d/rc.mysqld-nginx
/etc/rc.d/rc.mysqld-nginx restart

PHP-FPM installation (FastCGI Process Manager)

cd /usr/src
wget -c "http://pmoghadam.com/homepage/Pages/Deposit/Source-packages/php-5.4.0.tar.bz2"
su - install
cd /usr/src
tar xf php-5.4.0.tar.bz2
cd php-5.4.0
./configure \
  --prefix=/usr/local/nginx/php \
  --enable-pdo \
  --with-pdo-mysql \
  --with-pdo-sqlite=shared,/usr/local/nginx/php \
  --libdir=/usr/local/nginx/php/usr/lib \
  --with-libdir=lib \
  --sysconfdir=/usr/local/nginx/php/etc \
  --enable-mbregex \
  --enable-tokenizer=shared \
  --with-config-file-scan-dir=/usr/local/nginx/php/etc/php \
  --with-config-file-path=/usr/local/nginx/php/etc/httpd \
  --enable-mod_charset \
  --with-layout=PHP \
  --enable-sigchild \
  --enable-dom \
  --enable-libxml \
  --enable-xml \
  --with-libxml-dir=/usr/local/nginx/php/usr \
  --enable-simplexml \
  --enable-filter \
  --disable-debug \
  --with-openssl=shared \
  --with-pcre-regex=/usr \
  --with-zlib=shared,/usr \
  --enable-bcmath=shared \
  --with-bz2=shared,/usr/local/nginx/php/usr \
  --enable-calendar=shared \
  --enable-ctype=shared \
  --with-curl=shared \
  --with-curlwrappers \
  --enable-dba=shared \
  --with-gdbm=/usr/local/nginx/php/usr \
  --with-db4=/usr/local/nginx/php/usr \
  --enable-exif=shared \
  --enable-ftp=shared \
  --with-gd=shared \
  --with-jpeg-dir=/usr/local/nginx/php/usr \
  --with-png-dir=/usr/local/nginx/php/usr \
  --with-zlib-dir=/usr/local/nginx/php/usr \
  --with-xpm-dir=/usr/local/nginx/php/usr \
  --with-freetype-dir=/usr/local/nginx/php/usr \
  --with-t1lib=/usr/local/nginx/php/usr \
  --enable-gd-native-ttf \
  --enable-gd-jis-conv \
  --with-gettext=shared,/usr/local/nginx/php/usr \
  --with-gmp=shared,/usr/local/nginx/php/usr \
  --with-iconv=shared \
  --with-ldap=shared \
  --enable-mbstring=shared \
  --enable-hash \
  --with-mysql=shared,mysqlnd \
  --with-mysqli=shared,mysqlnd \
  --with-mysql-sock=/var/lib/nginx-mysql/mysql.sock \
  --with-pspell=shared,/usr \
  --with-enchant=shared,/usr \
  --with-mm=/usr/local/nginx/php/usr \
  --enable-shmop=shared \
  --with-snmp=shared,/usr \
  --enable-soap=shared \
  --enable-sockets \
  --with-sqlite3=shared \
  --with-regex=php \
  --enable-sysvmsg \
  --enable-sysvsem \
  --enable-sysvshm \
  --enable-wddx=shared \
  --with-xsl=shared,/usr/local/nginx/php/usr \
  --enable-zip=shared \
  --with-tsrm-pthreads \
  --enable-shared=yes \
  --enable-static=no \
  --with-gnu-ld \
  --with-pic \
  --enable-fpm
make -j 7 || make || make || make
make install INSTALL_ROOT=/usr/local/encap/nginx-php-5.4.0
logout
cd /usr/local/encap/nginx-php-5.4.0
find . -perm 777 -exec chmod -v 755 {} \;
find . -perm 775 -exec chmod -v 755 {} \;
find . -perm 664 -exec chmod -v 644 {} \;
cd /usr/local/encap/
chown -R root:root nginx-php-5.4.0
mkencap nginx-php-5.4.0/
epkg nginx-php-5.4.0/

/usr/local/nginx/php/etc/php-fpm.conf

[global]
[www]
user = apache
group = apache
listen = 127.0.0.1:9000
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3

/etc/rc.d/rc.php-fpm

#!/bin/bash
#
# /etc/rc.d/rc.php-fpm
#

PREFIX="/usr/local/nginx/php"
BIN="${PREFIX}/sbin/php-fpm"
CONF="${PREFIX}/etc/php-fpm.conf"
PID="${PREFIX}/var/run/php-fpm.pid"
INI="${PREFIX}/etc/php.ini"
OPTS="-c ${INI} --pid ${PID} --fpm-config ${CONF}"
TIMEOUT=35

wait_for_pid () {
  for try in $(seq 0 $TIMEOUT); do
    case "$1" in
      'created')
        [ -f "$2" ] && try='' && break
        ;;

      'removed')
        [ ! -f "$2" ] && try='' && break
        ;;
    esac
    echo -n .
    sleep 1
  done
}

case "$1" in

  start)
    echo -n "Starting php-fpm: "
    ${BIN} ${OPTS}
    [ "$?" != "0" ] && echo "Failed !!!" && exit 1
    wait_for_pid created $PID
    [ -n "$try" ] && echo "Failed !!!" && exit 1
    echo "Done."
    ;;

  stop)
    echo -n "Gracefully shutting down php-fpm: "
    [ ! -r $PID ] && echo "pid file not found - is php-fpm running?" && exit 1
    kill -QUIT $(cat $PID)
    wait_for_pid removed $PID
    [ -n "$try" ] && echo "Failed !!! Use force-quit" && exit 1
    echo "Done."
    ;;

  force-quit)
    echo -n "Terminating php-fpm: "
    [ ! -r $PID ] && echo "pid file not found - is php-fpm running?" && exit 1
    kill -TERM $(cat $PID)
    wait_for_pid removed $PID
    [ -n "$try" ] && echo "Failed !!! Use force-quit" && exit 1
    echo "Done."
    ;;

  restart)
    $0 stop
    $0 start
    ;;

  reload)
    echo -n "Reload service php-fpm: "
    [ ! -r $PID ] && echo "pid file not found - is php-fpm running?" && exit 1
    kill -USR2 $(cat $php_fpm_PID)
    echo "Done."
    ;;

  *)
    echo "Usage: $0 {start|stop|force-quit|restart|reload}"
    exit 1
    ;;

esac

/usr/local/nginx/php/etc/php.ini

[PHP]
engine = On
short_open_tag = Off
asp_tags = Off
precision = 14
y2k_compliance = On
output_buffering = 4096
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func =
serialize_precision = 17
allow_call_time_pass_reference = Off
safe_mode = Off
safe_mode_gid = Off
safe_mode_include_dir =
safe_mode_exec_dir =
safe_mode_allowed_env_vars = PHP_
safe_mode_protected_env_vars = LD_LIBRARY_PATH
disable_functions =
disable_classes =
expose_php = On
max_execution_time = 30
max_input_time = 60
memory_limit = 128M
error_reporting = E_ALL & ~E_DEPRECATED
display_errors = On
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off
html_errors = Off
variables_order = "GPCS"
request_order = "GP"
register_globals = Off
register_long_arrays = Off
register_argc_argv = Off
auto_globals_jit = On
post_max_size = 8M
magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
doc_root =
user_dir =
enable_dl = Off
file_uploads = On
upload_max_filesize = 2M
max_file_uploads = 20
allow_url_fopen = On
allow_url_include = Off
default_socket_timeout = 60
extension=bcmath.so
extension=bz2.so
extension=calendar.so
extension=ctype.so
extension=curl.so
extension=dba.so
extension=enchant.so
extension=exif.so
extension=ftp.so
extension=gd.so
extension=gettext.so
extension=gmp.so
extension=iconv.so
extension=ldap.so
extension=mbstring.so
extension=mysql.so
extension=mysqli.so
extension=openssl.so
extension=pdo.so
extension=pdo_mysql.so
extension=pdo_sqlite.so
extension=pspell.so
extension=shmop.so
extension=snmp.so
extension=soap.so
extension=sqlite.so
extension=sqlite3.so
extension=tokenizer.so
extension=wddx.so
extension=xsl.so
extension=zip.so
extension=zlib.so
[Date]
[filter]
[iconv]
[intl]
[sqlite]
[sqlite3]
[Pcre]
[Pdo]
[Pdo_mysql]
pdo_mysql.cache_size = 2000
pdo_mysql.default_socket=
[Phar]
[Syslog]
define_syslog_variables  = Off
[mail function]
SMTP = localhost
smtp_port = 25
mail.add_x_header = On
[SQL]
sql.safe_mode = Off
[ODBC]
odbc.allow_persistent = On
odbc.check_persistent = On
odbc.max_persistent = -1
odbc.max_links = -1
odbc.defaultlrl = 4096
odbc.defaultbinmode = 1
[Interbase]
ibase.allow_persistent = 1
ibase.max_persistent = -1
ibase.max_links = -1
ibase.timestampformat = "%Y-%m-%d %H:%M:%S"
ibase.dateformat = "%Y-%m-%d"
ibase.timeformat = "%H:%M:%S"
[MySQL]
mysql.allow_local_infile = On
mysql.allow_persistent = On
mysql.cache_size = 2000
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =
mysql.default_socket =
mysql.default_host =
mysql.default_user =
mysql.default_password =
mysql.connect_timeout = 60
mysql.trace_mode = Off
[MySQLi]
mysqli.max_persistent = -1
mysqli.allow_persistent = On
mysqli.max_links = -1
mysqli.cache_size = 2000
mysqli.default_port = 3306
mysqli.default_socket =
mysqli.default_host =
mysqli.default_user =
mysqli.default_pw =
mysqli.reconnect = Off
[mysqlnd]
mysqlnd.collect_statistics = On
mysqlnd.collect_memory_statistics = Off
[OCI8]
[PostgresSQL]
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0
[Sybase-CT]
sybct.allow_persistent = On
sybct.max_persistent = -1
sybct.max_links = -1
sybct.min_server_severity = 10
sybct.min_client_severity = 10
[bcmath]
bcmath.scale = 0
[browscap]
[Session]
session.save_handler = files
session.save_path = "/var/lib/php"
session.use_cookies = 1
session.use_only_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.bug_compat_42 = Off
session.bug_compat_warn = Off
session.referer_check =
session.entropy_length = 0
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 5
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
[MSSQL]
mssql.allow_persistent = On
mssql.max_persistent = -1
mssql.max_links = -1
mssql.min_error_severity = 10
mssql.min_message_severity = 10
mssql.compatability_mode = Off
mssql.secure_connection = Off
[Assertion]
[COM]
[mbstring]
[gd]
[exif]
[Tidy]
tidy.clean_output = Off
[soap]
soap.wsdl_cache_enabled=1
soap.wsdl_cache_dir="/tmp"
soap.wsdl_cache_ttl=86400
soap.wsdl_cache_limit = 5
[sysvshm]
[ldap]
ldap.max_links = -1
[mcrypt]
[dba]

Starting php-fpm daemon

chmod +x /etc/rc.d/rc.php-fpm
/etc/rc.d/rc.php-fpm start
ps -A | grep php-fpm

Nginx installation

cd /usr/src
wget -c "http://pmoghadam.com/homepage/Pages/Deposit/Source-packages/nginx-1.0.13.tar.gz"
su - install
cd /usr/src
tar xf nginx-1.0.13.tar.gz
cd nginx-1.0.13
./configure \
  --with-http_ssl_module \
  --without-mail_pop3_module \
  --without-mail_imap_module \
  --without-mail_smtp_module \
  --with-http_stub_status_module \
  --with-rtsig_module \
  --with-select_module \
  --with-poll_module \
  --with-http_realip_module \
  --with-http_addition_module \
  --with-http_xslt_module \
  --with-http_sub_module \
  --with-http_dav_module \
  --with-http_flv_module \
  --with-http_gzip_static_module \
  --with-http_random_index_module \
  --with-http_secure_link_module \
  --with-http_stub_status_module
make
make install DESTDIR=/usr/local/encap/nginx-1.0.13
cd /usr/local/encap/nginx-1.0.13
mkdir -p usr/local/nginx/conf/sites-enabled
logout
cd /usr/local/encap
chown -R  root:root nginx-1.0.13/
mkencap nginx-1.0.13/
epkg  nginx-1.0.13/

/usr/local/nginx/conf/fastcgi_params

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_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

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;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;

fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors on;

/usr/local/nginx/conf/nginx.conf

user  nobody;
worker_processes  6;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  10 10;

    gzip on;
    gzip_comp_level 1;
    gzip_proxied any;
    gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;

    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  logs/nginx_access.log  main;
    error_log  logs/nginx_error.log debug;

    include /usr/local/nginx/conf/sites-enabled/*;
}

/usr/local/nginx/conf/sites-enabled/default.conf

server {
    listen 8000;
    server_name localhost;
    #access_log  /var/log/nginx/localhost.access.log;

## Default location
    location / {
        root /srv/nginx;
        index index.php;
    }

## Images and static content is treated different
    location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
      access_log        off;
      expires           30d;
      root /srv/nginx;
    }

## Parse all .php file in the /srv/nginx directory
    location ~ .php$ {
        fastcgi_split_path_info ^(.+\.php)(.*)$;
        fastcgi_pass   backend;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /srv/nginx$fastcgi_script_name;
        include fastcgi_params;
        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_intercept_errors        on;
        fastcgi_ignore_client_abort     off;
        #fastcgi_connect_timeout 60;
        #fastcgi_send_timeout 180;
        #fastcgi_read_timeout 180;
        #fastcgi_buffer_size 128k;
        #fastcgi_buffers 4 256k;
        #fastcgi_busy_buffers_size 256k;
        #fastcgi_temp_file_write_size 256k;
    }

## Disable viewing .htaccess & .htpassword
    location ~ /\.ht {
        deny  all;
    }
}
upstream backend {
        server 127.0.0.1:9000;
}

/etc/rc.d/rc.nginx

#!/bin/bash
#
# Nginx daemon control script.
#

BIN="/usr/local/nginx/sbin/nginx"
CONF="/usr/local/nginx/conf/nginx.conf"
PID_FILE="/usr/local/nginx/logs/nginx.pid"
PID="$(pgrep -o '^nginx$')"

nginx_start()
{
  if [ ! -r "$CONF" ]; then
    echo "$CONF does not appear to exist. Abort."
    exit 1
  fi

  if [ -n "$PID" ]; then
    echo "Nginx appears to already be running?"
    echo "$PID exists. Abort."
    exit 1
  fi

  echo "Starting Nginx server daemon..."
  [ -e "$PID_FILE" ] && rm "$PID_FILE"
  if [ -x $BIN ]; then
    $BIN -c $CONF
  fi
}

nginx_test_conf() {
  echo "Checking configuration for correct syntax and"
  echo "then trying to open files referenced in configuration..."
  $BIN -t -c $CONF
}

nginx_term() {
  echo "Shutdown Nginx quickly..."
  kill -TERM $PID
}

nginx_stop() {
  echo "Shutdown Nginx gracefully..."
  kill -QUIT $PID
}

nginx_reload() {
  echo "Reloading Nginx configuration..."
  kill -HUP $PID
}

nginx_rotate() {
  echo "Rotating Nginx logs..."
  kill -USR1 $PID
}

nginx_restart() {
  nginx_stop
  sleep 3
  nginx_start
}

case "$1" in
  check)
    nginx_test_conf
    ;;
  start)
    nginx_start
    ;;
  term)
    nginx_term
    ;;
  stop)
    nginx_stop
    ;;
  reload)
    nginx_reload
    ;;
  restart)
    nginx_restart
    ;;
  rotate)
    nginx_rotate
    ;;
  *)
  echo "usage: `basename $0` {check|start|term|stop|reload|restart|rotate}"
esac

Commands

mkdir -p /srv/nginx/
chown nobody:nobody /srv/nginx/
chmod +x /etc/rc.d/rc.nginx
/etc/rc.d/rc.nginx start

/srv/nginx/index.php

<?php phpinfo(); ?>

/etc/rc.d/rc.local

/etc/rc.d/rc.mysqld-nginx start
/etc/rc.d/rc.php-fpm start
/etc/rc.d/rc.nginx start

/etc/rc.d/rc.local_shutdown

#!/bin/bash

/etc/rc.d/rc.nginx stop
/etc/rc.d/rc.php-fpm stop
/etc/rc.d/rc.mysqld-nginx stop

Commands

chmod +x /etc/rc.d/rc.local_shutdown

Note: nginx original configure command line

./configure \
  --prefix=/usr \
  --sbin-path=/usr/sbin/nginx \
  --conf-path=/etc/nginx/nginx.conf \
  --pid-path=/var/run/nginx.pid \
  --lock-path=/var/lock/nginx \
  --user=${NGINXUSER:=nobody} \
  --group=${NGINXGROUP:=nogroup} \
  --error-log-path=/var/log/nginx/error.log \
  --http-log-path=/var/log/nginx/access.log \
  --with-rtsig_module \
  --with-select_module \
  --with-poll_module \
  --with-http_ssl_module \
  --with-http_realip_module \
  --with-http_addition_module \
  --with-http_xslt_module \
  --with-http_sub_module \
  --with-http_dav_module \
  --with-http_flv_module \
  --with-http_gzip_static_module \
  --with-http_random_index_module \
  --with-http_secure_link_module \
  --with-http_stub_status_module \
  --with-http_perl_module \
  --with-perl_modules_path=$installvendorlib \
  --http-client-body-temp-path=/var/tmp/nginx_client_body_temp \
  --http-proxy-temp-path=/var/tmp/nginx_proxy_temp \
  --http-fastcgi-temp-path=/dev/shm \
  --without-mail_pop3_module \
  --without-mail_imap_module \
  --without-mail_smtp_module

Note: php original configure command line

./configure \
  --prefix=/usr/local/nginx/php \
  --libdir=/usr/lib \
  --with-libdir=lib \
  --sysconfdir=/etc \
  --disable-safe-mode \
  --disable-magic-quotes \
  --enable-zend-multibyte \
  --enable-mbregex \
  --enable-tokenizer=shared \
  --with-config-file-scan-dir=/etc/php \
  --with-config-file-path=/etc/httpd \
  --enable-mod_charset \
  --with-layout=PHP \
  --enable-sigchild \
  --enable-xml \
  --with-libxml-dir=/usr \
  --enable-simplexml \
  --enable-filter \
  --disable-debug \
  --with-openssl=shared \
  --with-pcre-regex=/usr \
  --with-zlib=shared,/usr \
  --enable-bcmath=shared \
  --with-bz2=shared,/usr \
  --enable-calendar=shared \
  --enable-ctype=shared \
  --with-curl=shared \
  --with-curlwrappers \
  --with-mcrypt=/usr \
  --enable-dba=shared \
  --with-gdbm=/usr \
  --with-db4=/usr \
  --enable-exif=shared \
  --enable-ftp=shared \
  --with-gd=shared \
  --with-jpeg-dir=/usr \
  --with-png-dir=/usr \
  --with-zlib-dir=/usr \
  --with-xpm-dir=/usr \
  --with-freetype-dir=/usr \
  --with-t1lib=/usr \
  --enable-gd-native-ttf \
  --enable-gd-jis-conv \
  --with-gettext=shared,/usr \
  --with-gmp=shared,/usr \
  --with-iconv=shared \
  --with-imap-ssl=/usr \
  --with-imap=$IMAPLIBDIR \
  --with-ldap=shared \
  --enable-mbstring=shared \
  --enable-hash \
  --with-mysql=shared,mysqlnd \
  --with-mysqli=shared,mysqlnd \
  --with-mysql-sock=/var/run/mysql/mysql.sock \
  --enable-pdo=shared \
  --with-pdo-mysql=shared,mysqlnd \
  --with-pdo-sqlite=shared,/usr \
  --with-pspell=shared,/usr \
  --with-enchant=shared,/usr \
  --with-mm=/usr \
  --enable-shmop=shared \
  --with-snmp=shared,/usr \
  --enable-soap=shared \
  --enable-sockets \
  --with-sqlite=shared \
  --with-sqlite3=shared \
  --enable-sqlite-utf8 \
  --with-regex=php \
  --enable-sysvmsg \
  --enable-sysvsem \
  --enable-sysvshm \
  --enable-wddx=shared \
  --with-xsl=shared,/usr \
  --enable-zip=shared \
  --with-tsrm-pthreads \
  --enable-shared=yes \
  --enable-static=no \
  --with-gnu-ld \
  --with-pic \
  --enable-fpm

BY: Pejman Moghadam
TAG: nginx, php, mysql, epkg
DATE: 2012-07-17 09:54:22


Pejman Moghadam / Slackware [ TXT ]