Access Denied from url:xxx.com, Please use the url configured in config.js
Hi There,
Is there anybody can help me figure out this error? Since I upgraded to the latest version, I have been unable to access the background. Just tested with http://localhost:2368/ghost, It works well; however, always failed with domain name http://xxx.com/ghost.
Before and after the ghost upgrade, the configuration file without any changes. Attached both ghost and nginx configuration.
config.js
// ### Production
// When running Ghost in the wild, use the production environment
// Configure your URL and mail settings here
production: {
url: 'http://xxx.com/',
mail: {},
database: {
client: 'mysql',
connection: {
// filename: path.join(__dirname, '/content/data/ghost.db')
st : '127.0.0.1',
user : 'xxx',
password : 'xx',
database : 'xxx',
charset : 'utf8'
},
debug: false
},
privacy: {
useGoogleFonts: false,
//useGravatar: false
},
server: {
// Host to be passed to node's `net.Server#listen()`
host: '127.0.0.1',
// Port to be passed to node's `net.Server#listen()`, for iisnode set this to `process.env.PORT`
port: '2368'
}
},
ghost.conf
server {
listen 80;
server_name xxx.com www.xxx.com;
access_log /home/xx/logs/xxx.com.log;
location / {
proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
#proxy_set_header X-NginX-Proxy true;
proxy_redirect off;
proxy_pass http://127.0.0.1:2368;
#proxy_buffering off;
}
}
Big Thanks..
Made a stupid mistake. Just forgot to set NODE_ENV=production
@Hell0wor1d hi, I met the same question , how to set the NODE_ENV ?
@jeremywu0127 refer http://docs.ghost.org/pl/usage/configuration/
Using Environments
In order to set Ghost to run under a different environment, you need to use an environment variable. For example if you normally start Ghost with node index.js you would use:
NODE_ENV=production node index.js
Or if you normally use forever:
NODE_ENV=production forever start index.js
Or if you're used to using npm start you could use the slightly easier to remember:
npm start --production
@Hell0wor1d aha, it works ! Thx
@jeremywu0127 不客气。
同样的问题
npm start --production
config时配置的producation url 是自己的域名,但是直接上述命令时,会提示
Listening on 127.0.0.1:2368
Url configured as: http://localhost:2368
我按照题主的方法,设置了NODE_ENV=production node index.js,发现可以了+.+
Your blog is now available on http://getcha22.cn
我去试试forever
config = {
production: {
url: 'http://URL',
mail: {},
database: {
client: 'sqlite3',
connection: {
filename: path.join(__dirname, '/content/data/ghost.db')
},
debug: false
},
还有可能是URL那里的指向问题,如果都改成127.0.0.1的话,当然也没有办法登陆了
config = {
production: {
url: 'http://xxx.com',
mail: { },
database: {
client: 'mysql',
connection: {
host : '127.0.0.1',
user : 'xxx',
password : 'xxx',
database : 'ghost',
charset : 'utf8'
},
debug: false
},
server: {
host: '127.0.0.1',
port: '2368'
},
}
}
按照上面的来操作怎么弄都提示这个Access Denied from url:xxx.com, Please use the url configured in config.js