Centos 7 + PHP 7.4 + Nginx 1.19.9 + Lua Modul Kurulumu

Merhabalar,

İhtiyacım olan centos 7 , php 7.4, nginx ve lua modülü için kurulum notlarım(Kurulum rehberi değildir, hızlı bir şekilde sonuca ulaştığım işlemler):

yum update -y
yum install epel-release -y
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
yum --enablerepo=remi-php74 install php
yum --enablerepo=remi-php74 search php
yum --enablerepo=remi-php74 install php-mysql php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt
php --version
systemctl enable php-fpm.service
systemctl start php-fpm.service
yum install tar wget -y
wget http://luajit.org/download/LuaJIT-2.0.5.tar.gz 
tar -zxvf LuaJIT-2.0.5.tar.gz
cd LuaJIT-2.0.5
yum install gcc -y
make && make install PREFIX=/usr/local/LuaJIT
export LUAJIT_LIB=/usr/local/LuaJIT/lib
export LUAJIT_INC=/usr/local/LuaJIT/include/luajit-2.0
wget https://github.com/simpl/ngx_devel_kit/archive/v0.3.0.tar.gz
wget https://github.com/openresty/lua-nginx-module/archive/v0.10.9rc7.tar.gz 
wget http://nginx.org/download/nginx-1.19.9.tar.gz
tar zxvf nginx-1.19.9.tar.gz
cd nginx-1.19.9
export LUAJIT_LIB=/usr/local/LuaJIT/lib
export LUAJIT_INC=/usr/local/LuaJIT/include/luajit-2.0
yum install -y install libaio pcre-devel openssl-devel libxslt-devel gd gd-devel perl-ExtUtils-Embed perftools gperftools-devel
./configure --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-compat --with-debug --with-google_perftools_module --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_degradation_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_mp4_module --with-http_perl_module=dynamic --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_xslt_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-stream_ssl_preread_module --with-threads  --add-module=../ngx_devel_kit-0.3.0/ --add-module=../lua-nginx-module-0.10.9rc7/
ln -s /usr/sbin/nginx /usr/bin/nginx
/usr/sbin/nginx -t
ln -s /usr/local/LuaJIT/lib/libluajit-5.1.so.2 /lib64/libluajit-5.1.so.2

#nginx.service dosyasına aşağıdaki servis parametrelerini girin.
nano /lib/systemd/system/nginx.service
[Unit]
Description=The nginx HTTP and reverse proxy server
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/run/nginx.pid
# Nginx will fail to start if /run/nginx.pid already exists but has the wrong
# SELinux context. This might happen when running `nginx -t` from the cmdline.
# https://bugzilla.redhat.com/show_bug.cgi?id=1268621
ExecStartPre=/usr/bin/rm -f /run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t
ExecStart=/usr/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
KillSignal=SIGQUIT
TimeoutStopSec=5
KillMode=mixed
PrivateTmp=true

[Install]
WantedBy=multi-user.target

systemctl enable nginx
systemctl start nginx

/etc/nginx/conf.d/domainadim.conf

server {
        listen   80;

        root /var/www/domainim;
        index index.php index.html index.htm;
        server_name  domainim.com;

        location / {
                try_files $uri $uri/ /index.html;
        }

        error_page 404 /404.html;
        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
              root /usr/share/nginx/www;
        }

        location ~ .php$ {
                try_files $uri =404;
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }


location /lua {
  default_type 'text/html';
  content_by_lua '
    ngx.say("hello, lua!")
  ';
 }

}

url.com/lua adresine erişim yaptığımda:

 

 

 

 

 

 

 

 

 

 

 

 

Kaynaklarım:

Bir cevap yazın

E-posta hesabınız yayımlanmayacak.

Bu site reCAPTCHA ve Google tarafından korunmaktadır Gizlilik Politikası ve Kullanım Şartları uygula.

The reCAPTCHA verification period has expired. Please reload the page.