Konfigurasi new virtualhost nginx
[root@sysops-test5 nginx]# cp nginx.conf conf.d/
[root@sysops-test5 nginx]# cd conf.d/
[root@sysops-test5 conf.d]# ls
nginx.conf
[root@sysops-test5 conf.d]# mv nginx.conf sysops.net.conf
edit sysops.net.conf
example:
server {
listen 8000;
server_name sysops.net;
root /usr/share/nginx/html/dashboard2/public;
index index.php index.html index.htm;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
#try_files $uri $uri/ /index.php?$query_string;
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Restart service nginx
Install Laravel
cd /usr/share/nginx/html/
composer create-project laravel/laravel dashboard2 "5.7"
[root@sysops-test5 nginx]# cd conf.d/
[root@sysops-test5 conf.d]# ls
nginx.conf
[root@sysops-test5 conf.d]# mv nginx.conf sysops.net.conf
edit sysops.net.conf
example:
server {
listen 8000;
server_name sysops.net;
root /usr/share/nginx/html/dashboard2/public;
index index.php index.html index.htm;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
#try_files $uri $uri/ /index.php?$query_string;
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Restart service nginx
Install Laravel
cd /usr/share/nginx/html/
composer create-project laravel/laravel dashboard2 "5.7"
Komentar