【Nginx】Nginx虛擬vhost配置檔案
Nginx可以採用vhost虛擬配置檔案配置多個conf,多個域名多個配置檔案方便管理
主配置檔案
與http的alias差不多的
主配置檔案
-
[root@iZ251xiy3yfZ conf]# more nginx.conf
-
-
#user nobody;
-
worker_processes 1;
-
-
#error_log logs/error.log;
-
#error_log logs/error.log notice;
-
#error_log logs/error.log info;
-
-
#pid logs/nginx.pid;
-
-
-
events {
-
worker_connections 1024;
-
}
-
-
-
http {
-
server
-
{
-
listen 80;
-
server_name _;
-
root /tmp/fuckyou;
-
location /phpfpm-status
-
{
-
fastcgi_pass 127.0.0.1:9000;
-
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
-
allow 127.0.0.1;
-
deny all;
-
}
-
-
-
location /nginx_status
-
{
-
stub_status on;
-
access_log off;
-
allow 127.0.0.1;
-
deny all;
-
}
-
}
-
server
-
{
-
listen 8080;
-
server_name _;
-
return 403;
-
}
-
-
include vhost/*.conf;
-
}
-
某個域名配置檔案
-
[root@iZ251xiy3yfZ conf]# more vhost/testapi.luobohr.com.conf
-
server {
-
listen 80;
-
server_name testapi.luobohr.com ;
- root /home/wwwroot/api.luobohr.com; ##域名與目錄
-
-
location / {
-
index index.php index.html;
-
if ( !-e $request_filename){
-
rewrite ^/(.*)$ /index.php?s=$1 last;
-
break;
-
}
-
}
-
-
-
location ~ .*\.(php|php5)?$ {
- root /home/wwwroot/api.luobohr.com; 目錄
-
-
try_files $uri =404;
-
fastcgi_pass 127.0.0.1:9000; ----php-fpm埠
-
fastcgi_index index.php;
-
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
-
include fastcgi_params;
-
}
-
location ~ /.git
-
{
-
return 403;
-
}
-
location ~* ^/Admin{
-
return 403;
-
}
-
-
location ~* ^/bank{
-
return 403;
- }
- }
與http的alias差不多的
-
cat /etc/httpd/conf.d/zabbix.conf
-
#
-
# Zabbix monitoring system php web frontend
-
#
-
-
Alias /zabbix /usr/share/zabbix
-
-
<Directory "/usr/share/zabbix">
-
Options FollowSymLinks
-
AllowOverride None
-
Require all granted
-
-
<IfModule mod_php5.c>
-
php_value max_execution_time 300
-
php_value memory_limit 128M
-
php_value post_max_size 16M
-
php_value upload_max_filesize 2M
-
php_value max_input_time 300
-
php_value always_populate_raw_post_data -1
-
# php_value date.timezone Europe/Riga
-
</IfModule>
-
</Directory>
-
-
<Directory "/usr/share/zabbix/conf">
-
Require all denied
-
</Directory>
-
-
<Directory "/usr/share/zabbix/app">
-
Require all denied
-
</Directory>
-
-
<Directory "/usr/share/zabbix/include">
-
Require all denied
-
</Directory>
-
-
<Directory "/usr/share/zabbix/local">
-
Require all denied
- </Directory>
訪問http://****/zabbix/ 指向這個目錄
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29096438/viewspace-2123306/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- nginx伺服器配置多個虛擬主機vhost的方法示例Nginx伺服器
- Nginx虛擬主機配置Nginx
- nginx配置檔案Nginx
- Nginx 配置檔案Nginx
- Nginx 配置檔案 nginx.conf 中文詳解Nginx
- Nginx的配置檔案說明Nginx
- Nginx的配置檔案詳解Nginx
- 在windows雙系統中,nginx配置虛擬域名WindowsNginx
- Linux下玩轉nginx系列(二)——nginx配置檔案說明LinuxNginx
- Nginx基礎02:配置檔案nginx.conf(Part1)Nginx
- nginx.conf 配置檔案詳解Nginx
- Gixy–分析Nginx配置檔案的工具Nginx
- Nginx 配置檔案引數詳解Nginx
- openresty/nginx配置多個conf檔案RESTNginx
- Nginx配置檔案的語法格式Nginx
- nginx 基本命令和檔案配置Nginx
- nginx日誌配置檔案說明Nginx
- Nginx虛擬主機常用配置(學習筆記四)Nginx筆記
- nginx製作檢查配置bat檔案NginxBAT
- nginx 文件地址及配置檔案入門Nginx
- nginx虛擬主機實戰Nginx
- 007.Nginx虛擬主機Nginx
- Linux下玩轉nginx系列(三)---nginx日誌配置檔案說明LinuxNginx
- 從零手寫實現 nginx-13-nginx.conf 配置例子解釋 + nginx 配置檔案要如何解析?Nginx
- Nginx 虛擬主機配置的三種方式(基於域名)Nginx
- Nginx 配置二級虛擬目錄訪問 Laravel 重寫NginxLaravel
- 透過nginx配置檔案抵禦攻擊Nginx
- Nginx配置Https專案NginxHTTP
- Nginx學習系列三Nginx的啟動、停止、修改配置檔案後重啟Nginx
- Nginx目錄結構與配置檔案詳解Nginx
- Nginx配置檔案詳解與優化建議Nginx優化
- Nginx 多 Laravel 專案配置NginxLaravel
- 詳解Nginx 虛擬主機配置的三種方式(基於埠)Nginx
- 詳解Nginx 虛擬主機配置的三種方式(基於IP)Nginx
- nginx偽靜態檔案Nginx
- nginx配置web訪問以及檢視目錄檔案NginxWeb
- nginx之 nginx限流配置Nginx
- Nginx 配置Nginx
- 配置nginxNginx